aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-05-22 13:29:28 +0100
committerGitHub <noreply@github.com>2024-05-22 13:29:28 +0100
commit84d00b21b553eb07c3228928b919a28badebba1f (patch)
tree5eba3fed0b43d8ad8bcf9cde2a0ce575a6c7cf50
parent79c11c149112a7dc3625842b6bcc41053bfb6366 (diff)
parent26f7afbe13ffc9829287d28082f5473070cd3338 (diff)
downloadperlweeklychallenge-club-84d00b21b553eb07c3228928b919a28badebba1f.tar.gz
perlweeklychallenge-club-84d00b21b553eb07c3228928b919a28badebba1f.tar.bz2
perlweeklychallenge-club-84d00b21b553eb07c3228928b919a28badebba1f.zip
Merge pull request #10136 from oWnOIzRi/week270
add fix for new test
-rw-r--r--challenge-270/steven-wilson/python/ch-2.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/challenge-270/steven-wilson/python/ch-2.py b/challenge-270/steven-wilson/python/ch-2.py
index aa703848be..9fcc5985f3 100644
--- a/challenge-270/steven-wilson/python/ch-2.py
+++ b/challenge-270/steven-wilson/python/ch-2.py
@@ -21,8 +21,13 @@ def distribute_elements(integers, x, y):
9
>>> distribute_elements([2, 3, 3, 3, 5], x=2, y=1)
6
+ >>> distribute_elements([4, 4, 2, 6], x=3, y=1)
+ 4
+ >>> distribute_elements([1, 1, 1, 6], x=3, y=1)
+ 10
'''
- max_int = max(integers)
+ integers = sorted(integers)
+ max_int = integers[-1]
level_1_preferred = (x * 2 < y)
cost = 0
positions = [i for i, v in enumerate(integers) if v < max_int]