Maximum non-consecutive stall scores

Write codeMedium12 min

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]) -> int
Example 1
Inputmax_stall_score([4, 9, 6, 3, 8])
Output18
Example 2
Inputmax_stall_score([2, 7, 9, 3, 1])
Output12