aboutsummaryrefslogtreecommitdiff
path: root/challenge-243/e-choroba/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-243/e-choroba/python/ch-1.py')
-rwxr-xr-xchallenge-243/e-choroba/python/ch-1.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-243/e-choroba/python/ch-1.py b/challenge-243/e-choroba/python/ch-1.py
new file mode 100755
index 0000000000..7ed59ec981
--- /dev/null
+++ b/challenge-243/e-choroba/python/ch-1.py
@@ -0,0 +1,12 @@
+#!/usr/bin/python3
+def reverse_pairs(*nums: int) -> int:
+ tally = 0
+ for j in range(1, len(nums)):
+ for i in range(0, j):
+ if nums[i] > 2 * nums[j]:
+ tally += 1
+ return tally
+
+assert reverse_pairs(1, 3, 2, 3, 1) == 2
+assert reverse_pairs(2, 4, 3, 5, 1) == 3
+