Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Precompute a prefix sum of ones ('1').
Iterate from left to right counting the number of zeros ('0'), then use the precomputed prefix sum for counting ones ('1'). Update the answer.