Most pay without back-to-back shifts
You're offered one shift a day, and the shift on day i pays pay[i]. You never work two days in a row: taking day i rules out days i - 1 and i + 1. Return the largest total you can earn.
pay may be empty and its values are non-negative. Aim for one pass and O(1) extra space.
Besides the tests, one large input (31 days) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
max_pay([2,7,9,3,1])→12max_pay([5,1,1,5])→10max_pay([2,3,2])→4