Largest buff card score

Write codeMedium25 min

Your task

A card game applies a run of buff cards to one hero. Buff i multiplies the hero's score by multipliers[i] and then adds bonuses[i] on top. Every buff in the hand is played exactly once and you choose the order. Scores are whole numbers, every multiplier is at least 1, and every bonus is at least 1. The hero starts on base_score. Return the largest score the hand can end on. The two lists have the same length, and an empty hand leaves the hero on base_score. Playing the biggest multiplier first is not the answer, and neither is playing the biggest bonus first.

Examples

max_buffed_score(base_score: int, multipliers: list[int], bonuses: list[int]) -> int
Example 1
Inputmax_buffed_score(0, [2, 3], [1, 1])
Output4
Example 2
Inputmax_buffed_score(5, [1, 4], [7, 2])
Output50