Given a binary matrix that has dimensions , 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.
Example 1:
[[1, 0], [1, 1], [0, 1]]
[1, 2]
[1, 1] contains the most ones, so the output is [1, 2].Example 2:
[[0, 1, 1], [0, 1, 1], [1, 1, 1]]
[2, 3]
[1, 1, 1] has the most ones, leading to the output [2, 3].Example 3:
[[1, 0, 1], [0, 0, 1], [1, 1, 0]]
[0, 2]
[0, 2].Constraints:
m == mat.lengthn == mat[i].length1 <= m, n <= 100mat[i][j] is either 0 or 1.