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.
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
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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 0
No packages published