Back to course home
0% completed
Vote For New Content
Solution: Row With Maximum Ones(easy)
Problem Statement
Given a binary matrix that has dimensions m * n, consisting of ones and zeros. Determine the row that contains the highest number of ones and return two values: the zero-based index of this row and the actual count of ones it possesses.
If there is a tie, i.e., multiple rows contain the same maximum number of ones, we must select the row with the lowest index.
Examples
Example 1:
- Input:
[[1, 0], [1, 1], [0, 1]]
- Expected Output:
[1, 2]
- Justification: The second row
[1, 1]
contains the most ones, so the output is[1, 2]
.
.....
.....
.....
Like the course? Get enrolled and start learning!
On this page