A latin square of order n is a matrix n × n such that in each row and column appears all the numbers between 1 and n. For instance,
⎛ ⎜ ⎜ ⎝ |
| ⎞ ⎟ ⎟ ⎠ | and | ⎛ ⎜ ⎜ ⎜ ⎝ |
| ⎞ ⎟ ⎟ ⎟ ⎠ |
are respectively latin squares of order 3 and 4.
Using the declarations
write a function
that prints if |q| is a latin square or not.
Precondition
|q| is not empty and really squared. All its numbers are natural.
Observation You only need to submit the required procedure; your main program will be ignored.