Skip to content

Commit dc15a45

Browse files
authored
Create row-with-maximum-ones.py
1 parent c1a7ecc commit dc15a45

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Python/row-with-maximum-ones.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Time: O(m * n)
2+
# Space: O(1)
3+
4+
# array
5+
class Solution(object):
6+
def rowAndMaximumOnes(self, mat):
7+
"""
8+
:type mat: List[List[int]]
9+
:rtype: List[int]
10+
"""
11+
return max(([i, mat[i].count(1)] for i in xrange(len(mat))), key=lambda x: x[1])

0 commit comments

Comments
 (0)