totalOnes
).totalOnes
is not divisible by 3, return [-1, -1]
as it is impossible to divide the array into three parts with equal binary values.targetOnes
which is totalOnes / 3
.targetOnes
th, (targetOnes
+1)th, 2*targetOnes
th, (2*targetOnes
+1)th, and 3*targetOnes
th ones in the array.[i1, j1]
, [i2, j2]
, and [i3, j3]
.j3
(trailingZeros
).[i1, j1]
, [i2, j2]
to include trailingZeros
.[j1+trailingZeros, j2+trailingZeros+1]
.[-1, -1]
.