Mira poses the river crossing puzzle to Sanju. A boatman wants to cross a river in a boat. He has to take a lion, a sheep, and a bundle of grass with him. He can take one of them at a time.
Advertisements
Question
Mira poses the river crossing puzzle to Sanju.
A boatman wants to cross a river in a boat. He has to take a lion, a sheep, and a bundle of grass with him. He can take one of them at a time. If the sheep and grass are left on the shore, the sheep will eat the grass. And, if the sheep and lion are left on the shore, the lion will eat the sheep.

How can the boatman take the lion, sheep, and grass across the river?
Help him so that he can ferry the lion, sheep, and grass across the river safely, and in the minimum number of trips.

Advertisements
Solution
Minimum number of trips: 7.
Let S = sheep, L = lion, G = grass.
- Take S across.
- Return alone.
- Take L across.
- Bring S back.
- Take G across.
- Return alone.
- Take S across.
The sheep must be taken first because leaving sheep with grass would destroy the grass, and leaving lion with sheep would harm the sheep. Bringing the sheep back in trip 4 is the key balancing step. This is the minimum number of trips because every item except the sheep is carried across once, and the boatman must return after each forward trip except the last.
