aboutsummaryrefslogtreecommitdiff
path: root/challenge-327/ysth/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-327/ysth/python/ch-2.py')
-rw-r--r--challenge-327/ysth/python/ch-2.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-327/ysth/python/ch-2.py b/challenge-327/ysth/python/ch-2.py
new file mode 100644
index 0000000000..5bac3484fd
--- /dev/null
+++ b/challenge-327/ysth/python/ch-2.py
@@ -0,0 +1,19 @@
+import sys
+from itertools import pairwise
+
+ints = [ int(i) for i in sys.argv[1:] ]
+
+ints.sort()
+
+min_difference = None
+pair_starts = []
+
+for x,y in pairwise(ints):
+ if min_difference is None or y - x < min_difference:
+ min_difference = y - x
+ pair_starts = [x]
+ elif y - x == min_difference:
+ pair_starts.append(x)
+
+for i in pair_starts:
+ print([i, i + min_difference])