Write a function that, given a square matrix *m*, tells if it is symmetric or not.

Remember that a matrix m is symmetric if m_{i,j}=m_{j,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 |

is_symmetric(m: list) -> bool |

Information

- Author
- Jordi Petit
- Language
- English
- Translator
- Carlos Molina
- Original language
- Catalan
- Other languages
- Catalan
- Official solutions
- C++ Java Python
- User solutions
- C++ Java