symmetrical array
Problem
Given a number
n and a two-dimensional array of size
nxn. Check if this 2D array is symmetrical about the main diagonal. Print the word “
YES” if the two-dimensional array is symmetrical, and the word “
NO” - otherwise.
Input
The first line contains a number
n - the size of a two-dimensional array (n <= 10). Next come
n lines of
n numbers each - elements of a two-dimensional array.
Imprint
Print the word "
YES" if the array is symmetric, or "
NO" - otherwise
Example
| # |
Input |
Output |
| 1 |
3
0 1 2
1 2 3
2 3 4
| YES |