aboutsummaryrefslogtreecommitdiff
path: root/challenge-319/sgreen/python/ch-2.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-319/sgreen/python/ch-2.py')
-rwxr-xr-xchallenge-319/sgreen/python/ch-2.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/challenge-319/sgreen/python/ch-2.py b/challenge-319/sgreen/python/ch-2.py
new file mode 100755
index 0000000000..8c0127500c
--- /dev/null
+++ b/challenge-319/sgreen/python/ch-2.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import re
+import sys
+
+
+def minimum_common(list1: list[int], list2: list[int]) -> int:
+ intersection = set(list1) & set(list2)
+ return min(intersection) if intersection else -1
+
+
+def main():
+ # Convert input into integers
+ list1 = map(int, re.split(r'\D+', sys.argv[1]))
+ list2 = map(int, re.split(r'\D+', sys.argv[2]))
+ result = minimum_common(list1, list2)
+ print(result)
+
+
+if __name__ == '__main__':
+ main()