Puddles at Construction Site
CodeChefOpen on judge ↗
Imagine a construction site that is in the shape of a bar graph. When it rains, certain areas of the site fill up with rainwater to form puddles. Any excess rainwater the site cannot hold in puddles will run off the to the west or east and drain into the drain. Given an array of positive integers representing 2-D bar heights, design an algorithm (or write a function) that can compute the total
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start