The Wayback Machine - https://web.archive.org/web/20240118173141/https://www.geeksforgeeks.org/measuring-6l-water-4l-9l-buckets/
Open In App
Related Articles

Measuring 6L water from 4L and 9L buckets

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Question: Suppose you have a 4 liter jug and a 9 liter bucket . The buckets have no measurement lines on them either. How could you measure exactly 6 liter using only those buckets and you have as much extra water as you need ?

Solution:
Consider 2 buckets one 4L and other 9L. : Bucket 1 (4L) and Bucket2 (9L)

First fill the 9L bucket fully. : 0 L and 9 L

Pour the water into 4L bucket. : 4 L and 5 L

Empty the 4L bucket. : 0 L and 5 L

Repeat this twice. : 4 L and 1 L

Now you will left with 1L water in the 9L bucket : 0 L and 1 L

Now pour this 1L into the 4L bucket : 1 L and 0 L

Refill the 9L bucket. : 1 L and 9 L

Now pour the water from 9L into the 4L bucket until it fills up. : 4 L and 6 L

Now you are left with 6 L water in the 9L bucket.

Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated : 18 Jan, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads