2
def maximumBobPoints(self, numArrows: int, aliceArrows: List[int]) -> List[int]:5
def calc(i, remaining, score, arrows):6
# Base case. Update max score.7
if remaining == 0 or i == -1:8
if score > max_score[0]:10
max_score[1] = arrows[:]13
# Special handling for the last section. Use up all the arrows.16
calc(i - 1, 0, score + i, arrows)20
# Try to compete with Alice if there are enough arrows.21
arrowsNeeded = aliceArrows[i] + 122
if remaining >= arrowsNeeded:23
arrows[i] = arrowsNeeded24
calc(i - 1, remaining - arrowsNeeded, score + i, arrows)27
# Skip this section and go to the next section.28
calc(i - 1, remaining, score, arrows)30
# Kick off the recursion31
calc(len(aliceArrows) - 1, numArrows, 0, [0 for _ in aliceArrows])