There is a farmer who wishes to cross a river but he is not alone. He also has a goat, a wolf, and a cabbage along with him. There is only one boat available that can support the farmer and either of the goat, wolf or cabbage. So at a time, the boat can have only two objects (farmer and one other).

But the problem is, if the goat and wolf are left alone (either in the boat or onshore), the wolf will eat the goat. Similarly, if the Goat and cabbage are left alone, then goat will eat the cabbage. How many minimum trips for the farmer to get everything on the other side (without any harm)? Crossing the river counts as one trip.

The Answer is an integer . Just put the number without any decimal places.