Maximum non-consecutive stall scores
Your task
You are driving a long highway with food stalls in a fixed order, and a review app shows each stall's taste score (a positive integer). If you stop at a stall you will be too full to stop at the very next one, so you can never visit two consecutive stalls. Given the list of scores in road order, return the maximum total taste score you can collect over the whole trip. An empty list returns 0.
Examples
max_stall_score(scores: list[int]) -> intExample 1
Input
max_stall_score([4, 9, 6, 3, 8])Output
18Example 2
Input
max_stall_score([2, 7, 9, 3, 1])Output
12