← All problemsSign in

Garden Watering

Sufiland is rectangle in shape with dimensions n x 1, It’s length is divided into n equal units of 1 x 1 . Here is the tricky part, each unit is having different height from the ground. Let’s say ith unit is having height hi . Sufi wants to water Sufiland but she is too lazy to do that, So she decided to put all water on a single unit of Sufiland, and let the water flow. Sufi is interested to k

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start