Leetcode 2133: Check if Every Row and Column Contains All Numbers
In this problem, we are trying to find out in a 2-dimension if every number from 1 to n is in each row and each column:
An
n x n
matrix is valid if every row and every column contains all the integers from1
ton
(inclusive).
Given ann x n
integer matrixmatrix
, returntrue
if the matrix is valid. Otherwise, returnfalse
.
Two examples that we can use for testing:
