Write a function that, given a square matrix m, tells if it is symmetric or not.
Remember that a matrix m is symmetric if mi,j=mj,i for any i and for any j.
Precondition
m is a square matrix n× n with n ≥ 0.
Interface
C++ | typedef vector< vector<int> > Matrix; |
bool is_symmetric(const Matrix& m); | |
Java | public static boolean isSymmetric(int[][] m); |
Python | is_symmetric(m) # returns bool |
MyPy | is_symmetric(m: list[list[int]]) -> bool |