2133. Check if Every Row and Column Contains All Numbers
Easy
Previous2131. Longest Palindrome by Concatenating Two Letter WordsNext2144. Minimum Cost of Buying Candies With Discount
Last updated
Easy
Last updated
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:
Example 2:
Constraints:
n == matrix.length == matrix[i].length
1 <= n <= 100
1 <= matrix[i][j] <= n
Runtime: 215 ms, faster than 76.19%
Memory Usage: 7.8 MB, less than 80.95%