LeetCodeMetaData / check-if-every-row-and-column-contains-all-numbers.json
DataRepo's picture
Upload part 1 of 2
4097b71 verified
{
"id": 2254,
"name": "check-if-every-row-and-column-contains-all-numbers",
"difficulty": "Easy",
"link": "https://leetcode.com/problems/check-if-every-row-and-column-contains-all-numbers/",
"date": "2022-01-02",
"task_description": "An `n x n` matrix is **valid** if every row and every column contains **all** the integers from `1` to `n` (**inclusive**). Given an `n x n` integer matrix `matrix`, return `true` _if the matrix is **valid**._ Otherwise, return `false`. **Example 1:** ``` **Input:** matrix = [[1,2,3],[3,1,2],[2,3,1]] **Output:** true **Explanation:** In this case, n = 3, and every row and column contains the numbers 1, 2, and 3. Hence, we return true. ``` **Example 2:** ``` **Input:** matrix = [[1,1,1],[1,2,3],[1,2,3]] **Output:** false **Explanation:** In this case, n = 3, but the first row and the first column do not contain the numbers 2 or 3. Hence, we return false. ``` **Constraints:** `n == matrix.length == matrix[i].length` `1 <= n <= 100` `1 <= matrix[i][j] <= n`",
"test_case": [
{
"label": "Example 1",
"input": "matrix = [[1,2,3],[3,1,2],[2,3,1]]",
"output": "true "
},
{
"label": "Example 2",
"input": "matrix = [[1,1,1],[1,2,3],[1,2,3]]",
"output": "false "
}
],
"constraints": [
"n == matrix.length == matrix[i].length",
"1 <= n <= 100",
"1 <= matrix[i][j] <= n"
],
"python_template": "class Solution(object):\n def checkValid(self, matrix):\n \"\"\"\n :type matrix: List[List[int]]\n :rtype: bool\n \"\"\"\n ",
"java_template": "class Solution {\n public boolean checkValid(int[][] matrix) {\n \n }\n}",
"metadata": {
"func_name": "checkValid"
}
}