AlgoViz
← All drills
🧠 Drill · Think it through

The shortest rainy stretch

The problem

You have a list of daily rainfall amounts. Find the length of the shortest contiguous run of days whose rainfall adds up to at least a target amount, or report that no such run exists. The days must be back-to-back, and all the amounts are positive.

Don't jump to code. Walk the four questions an expert asks first — you'll build the habit, not just the answer.

1

Restate it

Before anything else — did you read what's actually being asked? Strip the story to the bare goal.

Strip away the story. What are we actually asked to return?