diff options
Diffstat (limited to 'challenge-199/eric-cheung/python/ch-1.py')
| -rwxr-xr-x | challenge-199/eric-cheung/python/ch-1.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/challenge-199/eric-cheung/python/ch-1.py b/challenge-199/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..5227a2c7b1 --- /dev/null +++ b/challenge-199/eric-cheung/python/ch-1.py @@ -0,0 +1,20 @@ +
+from itertools import combinations
+
+def get_GoodPairs_List(arrInput):
+
+ arrGoodPairsList = []
+
+ nIndxTuple = combinations(range(0, len(arrInput)), 2)
+
+ for nIndxLoop_01, nIndxLoop_02 in list(nIndxTuple):
+ if arrInput[nIndxLoop_01] == arrInput[nIndxLoop_02]:
+ arrGoodPairsList.append([nIndxLoop_01, nIndxLoop_02])
+
+ return arrGoodPairsList
+
+## arrInputList = [1, 2, 3, 1, 1, 3] ## Example 1
+## arrInputList = [1, 2, 3] ## Example 2
+arrInputList = [1, 1, 1, 1] ## Example 3
+
+print (len(get_GoodPairs_List(arrInputList)))
|
