aboutsummaryrefslogtreecommitdiff
path: root/challenge-074/walt-mankowski/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-074/walt-mankowski/python/ch-1.py')
-rw-r--r--challenge-074/walt-mankowski/python/ch-1.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-074/walt-mankowski/python/ch-1.py b/challenge-074/walt-mankowski/python/ch-1.py
new file mode 100644
index 0000000000..7af167d60a
--- /dev/null
+++ b/challenge-074/walt-mankowski/python/ch-1.py
@@ -0,0 +1,15 @@
+from sys import argv
+from collections import defaultdict
+
+a = [int(x) for x in argv[1:]]
+target = len(a) / 2
+result = -1
+cnt = defaultdict(int)
+
+for x in a:
+ cnt[x] += 1
+ if cnt[x] > target:
+ result = x
+ break
+
+print(result)