aboutsummaryrefslogtreecommitdiff
path: root/challenge-276/eric-cheung/python
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-276/eric-cheung/python')
-rwxr-xr-xchallenge-276/eric-cheung/python/ch-1.py12
-rwxr-xr-xchallenge-276/eric-cheung/python/ch-2.py9
2 files changed, 21 insertions, 0 deletions
diff --git a/challenge-276/eric-cheung/python/ch-1.py b/challenge-276/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..abb3112347
--- /dev/null
+++ b/challenge-276/eric-cheung/python/ch-1.py
@@ -0,0 +1,12 @@
+
+from itertools import combinations
+
+## arrHours = [12, 12, 30, 24, 24] ## Example 1
+## arrHours = [72, 48, 24, 5] ## Example 2
+arrHours = [12, 18, 24] ## Example 3
+
+arrComb = combinations(arrHours, 2)
+
+arrOutput = [arrLoop for arrLoop in list(arrComb) if sum(arrLoop) % 24 == 0]
+
+print (len(arrOutput))
diff --git a/challenge-276/eric-cheung/python/ch-2.py b/challenge-276/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..1f41b77181
--- /dev/null
+++ b/challenge-276/eric-cheung/python/ch-2.py
@@ -0,0 +1,9 @@
+
+## arrInt = [1, 2, 2, 4, 1, 5] ## Example 1
+arrInt = [1, 2, 3, 4, 5] ## Example 2
+
+arrFreq = [arrInt.count(nLoop) for nLoop in set(arrInt)]
+
+nMaxFreq = max(arrFreq)
+
+print (nMaxFreq * arrFreq.count(nMaxFreq))