Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
6 lines - Greedy solution in Creative category for Team Play by JamesArruda
from typing import List
def max_score(cut: List[int], bend: List[int], k: int) -> int:
benefit = [c - b for c, b in zip(cut, bend)]
args = sorted(range(len(benefit)),key=benefit.__getitem__)[::-1]
return sum(cut[x] if i < k else bend[x] for i, x in enumerate(args))
May 13, 2020