Solving the Water Jug Problem

Ever played one of those games where you are given two water containers/jugs of different sizes and the task is to fill one of the jugs with a certain amount of water? Here’s an android app (image below) for the game if you aren’t familiar. Play it all you want because now I’m going to ruin it for you! I’m going to tell you a general solution to this water jug riddle.

waterlogic

The only thing you need to know is: Greatest Common Divisor.

Continue reading