diff options
Diffstat (limited to 'challenge-211/eric-cheung/python/ch-1.py')
| -rwxr-xr-x | challenge-211/eric-cheung/python/ch-1.py | 17 |
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)
|
