← All problemsSign in

Fill it

Arko decided to drink exactly **K** litres of water. However , in front of him, there is a tank of infinite amount of water and 2 empty bottles of quantity **x** litres and **y** litres respectively. Now Arko can do the following operations to any bottle - Fill it completely from the tank - Empty it entirely - Transfer as much water from bottle 1 to bottle 2, till bottle 1 gets empty or bottle 2

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