Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
zip solution in Clear category for Team Play by kurosawa4434
from typing import List
def max_score(cut: List[int], bend: List[int], k: int) -> int:
return sum(bend + sorted(c - b for c, b in zip(cut, bend))[-k:])
# These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
print("Example:")
print(max_score([4, 2, 1], [2, 5, 3], 2))
assert max_score([4, 2, 1], [2, 5, 3], 2) == 10, "Your team can do better."
assert max_score([7, 1, 4, 4], [5, 3, 4, 3], 2) == 18, "Bet you can improve this."
assert max_score([5, 5, 5], [5, 5, 5], 1) == 15, "Almost there!"
print("Coding complete? Click 'Check' to earn cool rewards!")
May 13, 2020
Comments: