Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
You need to reuse information about a row or a column many times. Try storing it to avoid computing it multiple times.
Use an array to store the number of 1’s in each row and another array to store the number of 1’s in each column. Once you know the number of 1’s in each row or column, you can also easily calculate the number of 0’s.