Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
When you iterate the array, maintain the number of zeros and ones on the left side. Can you quickly calculate the number of ones on the right side?
The number of ones on the right side equals the number of ones in the whole array minus the number of ones on the left side.
Alternatively, you can quickly calculate it by using a prefix sum array.