Max PnL when consecutive-day trades are forbidden
Each day has a known profit if you take a trade that day. A cooldown rule forbids trading on two consecutive days. Choose which days to trade to maximize total profit.
profit = [4, 1, 1, 9, 1]
-> 13 # trade day 0 (4) and day 3 (9); they are not adjacent
Return the maximum achievable profit under the no-adjacent-days rule, in O(n) time and O(1) space.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.