Adjacent swaps to group buys before sells
An order queue is a binary array: 0 marks a buy, 1 marks a sell. Using only swaps of adjacent elements, move all buys ahead of all sells. Find the minimum number of adjacent swaps required.
orders = [1, 0, 1, 0]
-> 3
Return the minimum adjacent swaps to bring all 0s before all 1s. Aim for .
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.