Check if Every Row and Column Contains All Numbers Problem
Check if Every Row and Column Contains All Numbers Problem — ExecCode Easy DSA Practice
Solve the Check if Every Row and Column Contains All Numbers problem on ExecCode. Free online easy DSA practice in Matrix. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given an n x n integer matrix matrix, return true if the matrix is valid. Your task is to otherwise, return false. An n x n matrix is valid if every row and every column contains all the integers from 1 to n (inclusive).
Examples
Input {"data": "3\n1 2 3\n3 1 2\n2 3 1"}; Output True. Input {"data": "3\n1 2 3\n1 2 3\n1 2 3"}; Output False. Input {"data": "1\n1"}; Output True
Constraints
n == matrix.length == matrix[i].length 1 <= n <= 100 1 <= matrix[i][j] <= n
Practice Check if Every Row and Column Contains All Numbers free on ExecCode. Browse DSA problems, topic map, and placement guides.