bits of length n holding only zeros and ones. Cutting it at position i (0 ≤ i ≤ n) splits it into two parts: the left part has the elements at indices 0 through i - 1, the right part has indices i through n - 1. With i = 0 the left part is empty; with i = n the right part is.
The score of a cut is the number of zeros in the left part plus the number of ones in the right part.
Return every position i whose score is the highest. The positions may come in any order.bits=[1, 0, 1, 1, 0] → [0, 2]
The cuts 0…5 score 3, 2, 3, 2, 1, 2. The best score, 3, is reached at positions 0 and 2.
bits=[0, 0, 1, 1] → [2]
Cutting right in the middle leaves every 0 on the left and every 1 on the right, for a score of 4.
bits=[1, 0] → [0, 2]
All three cuts score 1, so 0, 1 and 2 all qualify.
bits[i] is 0 or 1bits=[1, 0, 1, 1, 0]
[0, 2]
Run checks the first 3 tests in your browser. Submit checks all 101 tests on the server, hidden ones included.