Minimum bonus tokens

Write codeMedium16 min

Your task

People stand in a row and scores[i] is the i-th person's performance score. You hand out bonus tokens under two rules: everyone gets at least one token, and anyone whose score is strictly higher than an immediate neighbor's must receive more tokens than that neighbor. Return the minimum total number of tokens required. Example: scores [1, 0, 2] needs 5 tokens (2, 1, 2).

Examples

min_total_tokens(scores: list[int]) -> int
Example 1
Inputmin_total_tokens([1, 0, 2])
Output5