Dsa
Matrix
Easy
Matrix Symmetric Check
Determine whether a given matrix is symmetric. A matrix is symmetric if it is equal to its transpose. The transpose of a matrix is obtained by swapping rows with columns.
Input Format:
- The first line contains an integer N (the dimensions of the matrix, N x N).
- The next N lines contain N space-separated integers each, representing the matrix.
Output Format:
- Print 'YES' if the matrix is symmetric, otherwise print 'NO'.
Example:
Input:
3
1 2 3
2 4 5
3 5 6
Output:
YES
Key concepts
matrixsymmetryboolean
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now