Skip to content
DeepForgeby svx
All problems
MediumLinear Algebrala-032

Skew-Symmetric Matrix Check

Problem

Return True if matrix A is square and skew-symmetric: A[i][j] == -A[j][i] for all i, j.

A skew-symmetric matrix must have zeros on its diagonal.

Hint

The condition at (i, i) forces each diagonal entry to be 0.

Test cases

case 1
in: [[[0,1],[-1,0]]]
expected: true
case 2
in: [[[0,2,-1],[-2,0,3],[1,-3,0]]]
expected: true
case 3
in: [[[1,2],[3,4]]]
expected: false
case 4
in: [[[0,0],[0,0]]]
expected: true
Starter codePython
def is_skew_symmetric(A):
    # Your code here
    pass

4 test cases · run your code against them in the editor