bits of zeros and ones. Remove exactly one element of your choice.
Return the greatest length of a run of consecutive ones the remaining array can have. If no ones are left, return 0.bits=[1, 1, 0, 1, 1, 1, 0, 1] → 5
Remove the first zero to get [1, 1, 1, 1, 1, 0, 1]: five ones in a row.
bits=[1, 1, 1, 1] → 3
Removing an element is mandatory, so three ones are left.
bits=[0, 0] → 0
There are no ones at all.
bits) ≤ 10⁵bits[i] is 0 or 1bits=[1, 1, 0, 1, 1, 1, 0, 1]
5
Run checks the first 3 tests in your browser. Submit checks all 95 tests on the server, hidden ones included.