← back to unit
Easy
# breaking it down easy
Rain Barrel
The rain barrel fills day by day — when does it first overflow? 🌧️
You get the barrel's capacity and the rain collected each day. Print the first day (1-based) the running total reaches or passes capacity, or no overflow.
Example:
Input: capacity = 20, rain = [5, 8, 4, 9]
Output: 4
The running total climbs 5, 13, 17, 26 — it first reaches or passes 20 on day 4.
💡 need a hint?
brk-rain-barrel.py🔒 given lines are locked — write your code in between
loading...