Loading...
Loading...
Loading...
A shop records its sales for n days. Management wants the largest total over k days in a row. Print that total.
Example
Input
6 3 4 2 7 1 3 6
Output
13
The days 4 2 7 add up to 13, the best of all stretches.
Try the problem first. Open one hint at a time.
Add the first k values once, then move one day at a time.
Each move adds the new day and removes the day that left.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor