FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 2737,3 "name": "row-with-maximum-ones",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/row-with-maximum-ones/",6 "date": "2023-04-09",7 "task_description": "Given a `m x n` binary matrix `mat`, find the **0-indexed** position of the row that contains the **maximum** count of **ones,** and the number of ones in that row. In case there are multiple rows that have the maximum count of ones, the row with the **smallest row number** should be selected. Return_ an array containing the index of the row, and the number of ones in it._ **Example 1:** ``` **Input:** mat = [[0,1],[1,0]] **Output:** [0,1] **Explanation:** Both rows have the same number of 1's. So we return the index of the smaller row, 0, and the maximum count of ones (1`)`. So, the answer is [0,1]. ``` **Example 2:** ``` **Input:** mat = [[0,0,0],[0,1,1]] **Output:** [1,2] **Explanation:** The row indexed 1 has the maximum count of ones `(2)`. So we return its index, `1`, and the count. So, the answer is [1,2]. ``` **Example 3:** ``` **Input:** mat = [[0,0],[1,1],[0,0]] **Output:** [1,2] **Explanation:** The row indexed 1 has the maximum count of ones (2). So the answer is [1,2]. ``` **Constraints:** `m == mat.length` `n == mat[i].length` `1 <= m, n <= 100` `mat[i][j]` is either `0` or `1`.",8 "test_case": [9 {10 "label": "Example 1",11 "input": "mat = [[0,1],[1,0]]",12 "output": "[0,1] "13 },14 {15 "label": "Example 2",16 "input": "mat = [[0,0,0],[0,1,1]]",17 "output": "[1,2] "18 },19 {20 "label": "Example 3",21 "input": "mat = [[0,0],[1,1],[0,0]]",22 "output": "[1,2] "23 }24 ],25 "constraints": [26 "m == mat.length",27 "n == mat[i].length",28 "1 <= m, n <= 100",29 "mat[i][j] is either 0 or 1."30 ],31 "python_template": "class Solution(object):\n def rowAndMaximumOnes(self, mat):\n \"\"\"\n :type mat: List[List[int]]\n :rtype: List[int]\n \"\"\"\n ",32 "java_template": "class Solution {\n public int[] rowAndMaximumOnes(int[][] mat) {\n \n }\n}",33 "metadata": {34 "func_name": "rowAndMaximumOnes"35 }36}