Wednesday, May 11, 2016

Warden and Prisoners Interview Question

23 selected prisoners are summoned by the warden. He gives them a choice of playing a game with him that might ensure their escape from the prison or might as well lead them towards painful death. The prisoners think that this is the only chance for them to be free again and agrees to him.

The warden tell them that there is a room which has just two switches which are labelled 1 or 2. The switches may be up or down and the condition is not known at present. They are not connected to anything. The warden may select any prisoner on any day and send him to the switch room. The prisoner will have to select any one switch and reverse its position i.e. if it is up, he will turn it down and if it is down, he will turn it up. He can and must only flip one switch and then he will be confined to his cell again. 

The warden may choose the same prisoner more than one time and he will be choosing completely randomly. But at a certain point of time, everyone will have visited the switch room. And at any time, the prisoners may declare that everyone has visited the room at least once. If they will be true, they will be set free but if they will be wrong, they will be killed.

The warden gives them an hour to plan any kind of strategy and then they will be confined to their respective cells and will never be allowed to meet. What strategy can help them be free?

View  Solution

No comments:

Post a Comment