Tank overflow first day
A rainwater tank starts empty and has a capacity in liters. You are given the forecast daily inflow, in liters per day, as a list of integers (a maintenance drain may make a day negative). Return the index of the first day on which the cumulative total strictly exceeds the capacity, or -1 if that never happens. Example: inflows = [300, 200, 400], capacity = 800 gives 2, because the running totals are 300, 500, then 900.
Implement
overflow_day(inflows: list[int], capacity: int) → intExamples
in
[[300,200,400],800]out2What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 10 min
solution.py
InputExpectedGot
[[300,200,400],800]2not run yetsample