Fewest tokens for a scored row
People stand in a row and scores[i] is the score of the person at position i. Hand out reward tokens so that everyone gets at least one, and anyone with a strictly higher score than a person directly next to them gets more tokens than that neighbor. Return the minimum total number of tokens.
Neighbors with equal scores put no constraint on each other. scores may be empty.
Besides the tests, one large input (2,500 people) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
min_tokens([3,5,5])→4min_tokens([5,3,1])→6min_tokens([2,4,3,1])→7