You have two odd hourglasses: one that times exactly 4 minutes and one that times exactly 7 minutes. What is the best way to measure exactly 9 minutes using just these two hourglasses?
Solution
There are a couple of possible solutions.
Simpler solution
- Start both hourglasses at the same time.
- When the 4-min hourglass runs out, immediately flip it over.
- When the 7-min hourglass runs out, the 4-min hourglass should now have exactly 1 min of sand left. Immediately flip it over to start measuring the 9 min.
- Let the 1 min run out, then flip over and let the 4-min hourglass run out twice more, for a total of 1 + 4 + 4 = 9 min.
This solution works, but it involves wasting 7 minutes first.
Better solution
- Start both hourglasses at the same time, and start measuring the 9 min.
- When the 4-min hourglass runs out, immediately flip it over.
- When the 7-min hourglass runs out, the 4-min hourglass should now have exactly 1 min of sand left. Immediately flip both hourglasses over.
- When the remaining 1 min of the 4-min hourglass runs out, the 7-min hourglass should have accumulated exactly 1 min of sand at the bottom. Immediately flip it over to measure the last 1 min.
This solution essentially lets the 7-min hourglass run its course, and then adds two 1-min increments at the end.