From d3cd6c8a7072e6f3566176284074c04501bfe8e3 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 2 Jul 2024 13:19:01 +0100 Subject: - Added solutions by Eric Cheung. - Added solutions by Ulrich Rieke. - Added solutions by Roger Bell_West. - Added solutions by Robbie Hatley. - Added solutions by Simon Green. - Added solutions by Thomas Kohler. - Added solutions by Steven Wilson. - Added solutions by Mark Anderson. - Added solutions by PokGoPun. - Added solutions by W. Luis Mochan. - Added solutions by David Ferrone. - Added solutions by Peter Campbell Smith. - Added solutions by E. Choroba. - Added solutions by Ryan Thompson. - Added solutions by Matthew Neleigh. - Added solutions by Dave Jacoby. - Added solutions by Feng Chang. - Added solutions by Joelle Maslak. - Added solutions by Niels van Dijke. - Added solutions by Mariano Ortega. --- challenge-276/eric-cheung/python/ch-1.py | 12 ++++++++++++ challenge-276/eric-cheung/python/ch-2.py | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100755 challenge-276/eric-cheung/python/ch-1.py create mode 100755 challenge-276/eric-cheung/python/ch-2.py (limited to 'challenge-276/eric-cheung/python') 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)) -- cgit