Best total over k consecutive days
amounts[i] is the net result of day i; it can be negative. Return the largest sum of any k consecutive days.
Constraints: 1 <= k <= len(amounts). Aim for O(n): do not add up each window from scratch.
Besides the tests, one large input (16,000 days) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
best_window_sum([2,5,1,8,2,9,1], 3)→19best_window_sum([4,-2,7,-5,6], 2)→5best_window_sum([-5,-2,-8,-1,-4], 2)→-5