File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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/>
214214
215215# From <https://www.geeksforgeeks.org/dsa/find-the-row-with-maximum-number-1s/>
216216
217+
You can’t perform that action at this time.
0 commit comments