219k views
0 votes
A group of 25 soldiers must cross a wide and deep river. There are two boys playing in a rowboat by the shore. The boat is tiny, however, it can only hold two boys or one soldier. How can the soldiers get across the river and leave the boys in joint possession of the boat?

How many times does the boat pass from shore to shore in your algorithm?

User Lenkite
by
7.2k points

1 Answer

2 votes

Answer: The algorithm

Explanation: 1. Drop one of the boy on the other side of the shore

2. Let the other boy bring back the boat

3. Remove the boy and place a soldier to reach the other side.

4. Let the small boy bring back the boat.

Repeat the process for every soldier