aboutsummaryrefslogtreecommitdiff
path: root/challenge-211/eric-cheung/python/ch-1.py
diff options
context:
space:
mode:
authorPaulo Custodio <pauloscustodio@gmail.com>2023-04-07 11:52:10 +0100
committerPaulo Custodio <pauloscustodio@gmail.com>2023-04-07 11:52:10 +0100
commitc27917c2860cb2a203262d9cdeebd264c29456f2 (patch)
tree3b024d7c86e48d197d470779ceca31d31a6971a5 /challenge-211/eric-cheung/python/ch-1.py
parentbd0ea1891b53fb4cff93b57af6481f37dd268509 (diff)
parent419cb48e0bd7736f9b625a9f60ce52bc77be8f7a (diff)
downloadperlweeklychallenge-club-c27917c2860cb2a203262d9cdeebd264c29456f2.tar.gz
perlweeklychallenge-club-c27917c2860cb2a203262d9cdeebd264c29456f2.tar.bz2
perlweeklychallenge-club-c27917c2860cb2a203262d9cdeebd264c29456f2.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-211/eric-cheung/python/ch-1.py')
-rwxr-xr-xchallenge-211/eric-cheung/python/ch-1.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/challenge-211/eric-cheung/python/ch-1.py b/challenge-211/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..2376aa66d7
--- /dev/null
+++ b/challenge-211/eric-cheung/python/ch-1.py
@@ -0,0 +1,17 @@
+
+## arrMatrixInput = [[4, 3, 2, 1], [5, 4, 3, 2], [6, 5, 4, 3]] ## Example 1
+arrMatrixInput = [[1, 2, 3], [3, 2, 1]] ## Example 2
+
+nMatrixRow = len(arrMatrixInput)
+nMatrixCol = len(arrMatrixInput[0])
+
+nMinIndx = min(nMatrixRow, nMatrixCol)
+
+bIsToeplitzMatrix = True
+nDiagElem = arrMatrixInput[0][0]
+for nIndxLoop in range(1, nMinIndx):
+ if arrMatrixInput[nIndxLoop][nIndxLoop] != nDiagElem:
+ bIsToeplitzMatrix = False
+ break
+
+print (bIsToeplitzMatrix)