insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Check if a given square matrix is symmetric (A[i][j] == A[j][i] for all elements).

Check if a given square matrix is symmetric (A[i][j] == A[j][i] for all elements).

Difficulty: Medium

Phase: 6 · Mixed Logical Challenges

XP Reward: 20 XP

Topics: Mixed Logical Challenges, Medium

Supported Languages: Python, JavaScript, C, C++, Java

Problem Description

Given N followed by N x N matrix, check if matrix is symmetric (A[i][j] == A[j][i]). Print 'Yes' or 'No'. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).

Constraints

  • -10^9 <= N <= 10^9

Examples

Example 1

Input: 3 1 2 3 2 4 5 3 5 6

Output: Yes

Explanation: Sample execution for input 3 1 2 3 2 4 5 3 5 6