Buildings and rain
CodeChefOpen on judge ↗
There are N adjacent buildings with no gaps each of width one. You are given an input array which represents the heights of the each building. It starts raining. How much water is collected between the buildings? Input First line N Second line ‘N’ numbers separated by spaces which represents height. Output Amount of water collected between buildings. Constraints - 3 ≤ N ≤ 100 Example 1:
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