Skip to content

Commit 3e722d9

Browse files
Update Row with max 1s.py
1 parent c383e0f commit 3e722d9

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

Row with max 1s.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
# # 1 ≤ arr.size(), arr[i].size() ≤ 103
1717
# # 0 ≤ arr[i][j] ≤ 1
1818

19-
# # From <https://www.geeksforgeeks.org/problems/row-with-max-1s0023/1>
20-
# # import numpy as np
21-
# # class Solution:
22-
# # def rowWithMax1s(self, arr):
23-
# # # code here
24-
# # arr = np.array(arr)
25-
# # row_sums = np.sum(arr, axis=1)
26-
# # max_index = np.argmax(row_sums)
27-
# # return max_index
19+
# From <https://www.geeksforgeeks.org/problems/row-with-max-1s0023/1>
20+
import numpy as np
21+
class Solution:
22+
def rowWithMax1s(self, arr):
23+
# code here
24+
arr = np.array(arr)
25+
row_sums = np.sum(arr, axis=1)
26+
max_index = np.argmax(row_sums)
27+
return max_index
2828
# Find the row with maximum number of 1s
2929

3030
# From <https://www.geeksforgeeks.org/dsa/find-the-row-with-maximum-number-1s/>
@@ -214,3 +214,4 @@
214214

215215
# From <https://www.geeksforgeeks.org/dsa/find-the-row-with-maximum-number-1s/>
216216

217+

0 commit comments

Comments
 (0)