River, Soldiers & Boat

Consider there are 10 soldiers on the one side of the river. They need to go to the over side of the rever. There is no bridge in the rever and no one can swin in the rever. One of the soldiers spots the boat with two boys inside. The boat is very small and the boys in the boats also very small. The boat can either hold two boys or one soldier. Now tell me how can all soldiers go to the other side of the river using this boat ?





Solution :

First you have the two boys take the boat to one side of the river and leave a boy 
on that side of the river. One boy takes the boat back to the other side and stands 
on the shore. Then a soldier gets in the boat and rides it to the other side. 
When he arrives on the other side, then the boy gets in the boat and takes it back
to the other side and picks up the other boy. They ride back to the other shore and
drop off one of the boys and continue this process until all the soldiers are on 
the other side of the river.

Leave a Reply

Your email address will not be published. Required fields are marked *

For Inserting code :
Paste your code in the comment form, select it and then click the language link

C | C++ | Java |