Skip to content

Commit 289133d

Browse files
authored
Create remove-all-ones-with-row-and-column-flips.py
1 parent 93bdb6a commit 289133d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Time: O(m * n)
2+
# Space: O(1)
3+
4+
class Solution(object):
5+
def removeOnes(self, grid):
6+
"""
7+
:type grid: List[List[int]]
8+
:rtype: bool
9+
"""
10+
return all(grid[i] == grid[0] or all(grid[i][j] != grid[0][j] for j in xrange(len(grid[0]))) for i in xrange(1, len(grid)))

0 commit comments

Comments
 (0)