maxCount
to 0 and maxRow
to 0.i
of the matrix mat
.
a. Initialize a counter count
to 0 for the current row.
b. Iterate over each element j
in the current row.
i. If mat[i][j]
is 1, increment count
.
c. If count
is greater than maxCount
, update maxCount
with count
and maxRow
with the current row index i
.maxRow
and maxCount
.