← All problemsSign in

Water Filling in Containers

You are given $N$ containers of varying heights, $H_i$ for the $i^{th}$ container, which cannot hold more water than their heights. You have to fill water in these containers in such a way that the height of water filled in the $(i+1)^{th}$ container is $K$ more than the height of water filled in the $i^{th}$ container where $1 \leq i \leq N-1$. You need to find the maximum possible value of $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