Symmetric matrix P61473


Statement
 

pdf   zip   main.cc   main.java   main.py

thehtml

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
Information
Author
Jordi Petit
Language
English
Translator
Carlos Molina
Original language
Catalan
Other languages
Catalan
Official solutions
C++ Java Python
User solutions
C++ Java Python