Loading...
Loading...
Loading...
A website logs visitors per day. Find the largest total over any k consecutive days.
Example 1
Input
7 3 2 1 5 1 3 2 9
Output
14
3 + 2 + 9 = 14.
Example 2
Input
3 3 1 2 3
Output
6
Try the problem first. Open one hint at a time.
Find the total of the first k days, then slide one day at a time.
Add the new day and subtract the day that leaves.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor