aboutsummaryrefslogtreecommitdiff
path: root/challenge-268/eric-cheung/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-268/eric-cheung/python/ch-1.py')
-rwxr-xr-xchallenge-268/eric-cheung/python/ch-1.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-268/eric-cheung/python/ch-1.py b/challenge-268/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..093fd3f45c
--- /dev/null
+++ b/challenge-268/eric-cheung/python/ch-1.py
@@ -0,0 +1,25 @@
+
+## Example 1
+## arrX = [3, 7, 5]
+## arrY = [9, 5, 7]
+
+## Example 2
+## arrX = [1, 2, 1]
+## arrY = [5, 4, 4]
+
+## Example 3
+arrX = [2]
+arrY = [5]
+
+arrX = sorted(arrX)
+arrY = sorted(arrY)
+
+nDiff = arrY[0] - arrX[0]
+
+bIsSameDiff = True
+for nIndx in range(1, len(arrX)):
+ if arrY[nIndx] - arrX[nIndx] != nDiff:
+ bIsSameDiff = False
+ break
+
+print (nDiff if bIsSameDiff else "")