A farmer stood at a riverbank with his lion, goat, and a bundle of grass. He wanted to cross the river, but his boat could carry only one animal or item at a time, excluding himself. If he took the lion first, the goat would eat the grass. If he took the grass first, the lion would eat the goat.
Finally, he hit upon an idea. He first took the goat across the river and left it on the far bank. Then he returned alone and took the lion across.
He left the lion on the far bank but brought the goat back with him. He then left the goat at the starting bank and took the grass across.
After leaving the grass with the lion, he returned one last time and took the goat across.
Thus, the farmer successfully crossed the river with all three—the lion, the goat, and the grass—without any problems.