




Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use for loops to check each row for every number from 1 to n. Similarly, do the same for each column.
For each check, you can keep a set of the unique elements in the checked row/col. By the end of the check, the size of the set should be n.