Tap here to switch tabs
Problem
Submissions

Problem: Row With Maximum Ones

med
30 min
Try to solve the Row With Maximum Ones problem.

Statement

Given an m by n binary matrix mat, determine the 00 indexed row that contains the maximum number of ones, along with the count of ones present in that row.

If multiple rows share the same maximum count of ones, select the row with the smallest index.

Return an array of length 22 containing the selected row index and the maximum count of ones.

Constraints:

  • m ==== mat.length

  • n ==== mat[i].length

  • 1≤1 \leq m, n ≤100\leq 100

  • mat[i][j] is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Row With Maximum Ones

med
30 min
Try to solve the Row With Maximum Ones problem.

Statement

Given an m by n binary matrix mat, determine the 00 indexed row that contains the maximum number of ones, along with the count of ones present in that row.

If multiple rows share the same maximum count of ones, select the row with the smallest index.

Return an array of length 22 containing the selected row index and the maximum count of ones.

Constraints:

  • m ==== mat.length

  • n ==== mat[i].length

  • 1≤1 \leq m, n ≤100\leq 100

  • mat[i][j] is either 00 or 11.