Skip to content

You have two unmarked bottles that can hold 3 liters and 5 liters respectively, and a bathtub with unlimited water. You are allowed to either fill a bottle, empty a bottle or pour one bottle into the other until either the source bottle is empty or the target bottle is full. - how can 1 liter be measured? - how can 4 liters be measured? Implemen…

Flitig/BottleExercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BottleExercise

You have two unmarked bottles that can hold 3 liters and 5 liters respectively, and a bathtub with unlimited water. You are allowed to either fill a bottle, empty a bottle or pour one bottle into the other until either the source bottle is empty or the target bottle is full. - how can 1 liter be measured? - how can 4 liters be measured? Implement a solution that would solve this problem and find the minimum amount of steps required to measure the desired amount of water (1 and 4 liters). Note that the program should find the shortest solution given only the information above.

About

You have two unmarked bottles that can hold 3 liters and 5 liters respectively, and a bathtub with unlimited water. You are allowed to either fill a bottle, empty a bottle or pour one bottle into the other until either the source bottle is empty or the target bottle is full. - how can 1 liter be measured? - how can 4 liters be measured? Implemen…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages