2174. Remove All Ones With Row and Column Flips II
You are given a 0-indexed m x n binary matrix grid.
In one operation, you can choose any i and j that meet the following conditions:
- 0 <= i < m
- 0 <= j < n
- grid[i][j] == 1
and change the values of all cells in row i and column j to zero.
Return the minimum number of operations needed to remove all 1’s from grid.
c++
1 | class Solution { |