Loading...
Loading...
Loading...
A fundraiser records n daily donations, all positive. Find the smallest number of days in a row whose total is at least a target. Print 0 if no such run exists.
Example
Input
6 7 2 3 1 2 4 3
Output
2
The days 4 3 total 7, so the answer is 2.
Try the problem first. Open one hint at a time.
Add days on the right until the total reaches the target.
While it does, record the length and remove days from the left.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor