aboutsummaryrefslogtreecommitdiff
path: root/challenge-243/eric-cheung/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-243/eric-cheung/python/ch-1.py')
-rwxr-xr-xchallenge-243/eric-cheung/python/ch-1.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-243/eric-cheung/python/ch-1.py b/challenge-243/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..9ee2534f4b
--- /dev/null
+++ b/challenge-243/eric-cheung/python/ch-1.py
@@ -0,0 +1,18 @@
+
+from itertools import combinations
+
+def IsReversePair (arrInput):
+ if arrInput[0] > 2 * arrInput[1]:
+ return True
+ return False
+
+
+## arrNum = [1, 3, 2, 3, 1] ## Example 1
+arrNum = [2, 4, 3, 5, 1] ## Example 2
+
+
+arrCombList = combinations(arrNum, 2)
+arrOutputList = [arrLoop for arrLoop in list(arrCombList) if IsReversePair(arrLoop)]
+
+
+print (len(arrOutputList))