Latin Squares
Jump to navigation
Jump to search
This problem asks whether the given input grid is a latin square (each row/column has each character exactly once), and whether the first row and column are in order.
The input size is small enough that it suffices to examine each row and column. Easy way to do this is add the characters of each to a set and check that the size is exactly n.
NOTE: there is no guarantee that the used symbols are consecutive!!! so be sure to check that the set of characters in each row/column are the SAME
After that, we have to check the first row and column for sorted-ness. This suffices to check that each character that it goes in order.