aboutsummaryrefslogtreecommitdiff
path: root/challenge-198/eric-cheung/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-198/eric-cheung/python/ch-1.py')
-rwxr-xr-xchallenge-198/eric-cheung/python/ch-1.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-198/eric-cheung/python/ch-1.py b/challenge-198/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..34d0347180
--- /dev/null
+++ b/challenge-198/eric-cheung/python/ch-1.py
@@ -0,0 +1,12 @@
+
+arrInputList = [2, 5, 8, 1] ## Example 1
+## arrInputList = [3] ## Example 2
+
+arrInputList.sort()
+arrDiff = [arrInputList[nIndx + 1] - arrInputList[nIndx] for nIndx in range(0, len(arrInputList) - 1)]
+
+if len(arrDiff) > 0:
+ nMaxArrDiff = max(arrDiff)
+ print (arrDiff.count(nMaxArrDiff))
+else:
+ print (0)