Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes399downloads
modify-the-matrix.json32 linesDownload Raw Back to root
1{2  "id": 3330,3  "name": "modify-the-matrix",4  "difficulty": "Easy",5  "link": "https://leetcode.com/problems/modify-the-matrix/",6  "date": "2024-02-04",7  "task_description": "Given a **0-indexed** `m x n` integer matrix `matrix`, create a new **0-indexed** matrix called `answer`. Make `answer` equal to `matrix`, then replace each element with the value `-1` with the **maximum** element in its respective column. Return _the matrix_ `answer`. **Example 1:** ``` **Input:** matrix = [[1,2,-1],[4,-1,6],[7,8,9]] **Output:** [[1,2,9],[4,8,6],[7,8,9]] **Explanation:** The diagram above shows the elements that are changed (in blue). - We replace the value in the cell [1][1] with the maximum value in the column 1, that is 8. - We replace the value in the cell [0][2] with the maximum value in the column 2, that is 9. ``` **Example 2:** ``` **Input:** matrix = [[3,-1],[5,2]] **Output:** [[3,2],[5,2]] **Explanation:** The diagram above shows the elements that are changed (in blue). ``` **Constraints:** `m == matrix.length` `n == matrix[i].length` `2 <= m, n <= 50` `-1 <= matrix[i][j] <= 100` The input is generated such that each column contains at least one non-negative integer.",8  "test_case": [9    {10      "label": "Example 1",11      "input": "matrix = [[1,2,-1],[4,-1,6],[7,8,9]]",12      "output": "[[1,2,9],[4,8,6],[7,8,9]] "13    },14    {15      "label": "Example 2",16      "input": "matrix = [[3,-1],[5,2]]",17      "output": "[[3,2],[5,2]] "18    }19  ],20  "constraints": [21    "m == matrix.length",22    "n == matrix[i].length",23    "2 <= m, n <= 50",24    "-1 <= matrix[i][j] <= 100",25    "The input is generated such that each column contains at least one non-negative integer."26  ],27  "python_template": "class Solution(object):\n    def modifiedMatrix(self, matrix):\n        \"\"\"\n        :type matrix: List[List[int]]\n        :rtype: List[List[int]]\n        \"\"\"\n        ",28  "java_template": "class Solution {\n    public int[][] modifiedMatrix(int[][] matrix) {\n        \n    }\n}",29  "metadata": {30    "func_name": "modifiedMatrix"31  }32}