All problems
Strict Diagonal Dominance Check
Problem
Return True if matrix A is strictly diagonally dominant: in every row, the absolute diagonal entry is greater than the sum of the absolute off-diagonal entries.
Return False if A is not square or any row fails the test.
Hint
The inequality must be strict in every row; zero rows always fail.
Test cases
case 1
in: [[[2,1],[1,2]]]
expected: true
case 2
in: [[[1,2],[3,4]]]
expected: false
case 3
in: [[[0,0],[0,0]]]
expected: false
case 4
in: [[[5,1,-1],[0,3,1],[1,0,4]]]
expected: true
Starter codePython
def is_diagonally_dominant(A):
# Your code here
pass4 test cases · run your code against them in the editor