This is a puzzle question ....

The warden meets with 23 new prisoners when they arrive. He
tells them, "You may meet today and plan a strategy. But
after today, you will be in isolated cells and will have no
communication with one another.

"In the prison is a switch room, which contains two light
switches labeled A and B, each of which can be in either the
'on' or the 'off' position. I am not telling you their
present positions. The switches are not connected to anything.

"After today, from time to time whenever I feel so inclined,
I will select one prisoner at random and escort him to the
switch room. This prisoner will select one of the two
switches and reverse its position. He must move one, but
only one of the switches. He can't move both but he can't
move none either. Then he'll be led back to his cell.

"No one else will enter the switch room until I lead the
next prisoner there, and he'll be instructed to do the same
thing. I'm going to choose prisoners at random. I may choose
the same guy three times in a row, or I may jump around and
come back.

"But, given enough time, everyone will eventually visit the
switch room as many times as everyone else. At any time
anyone of you may declare to me, 'We have all visited the
switch room.' and be 100% sure.

"If it is true, then you will all be set free. If it is
false, and somebody has not yet visited the switch room, you
will be fed to the alligators."

What is the strategy they come up with so that they can be free?

Answer Posted / samy

The above answer is correct. But not optiomized. Onr small
correction. Everyone need to Flip the first switch only
once. And leader Need to Flip the first switch 22 times.

Is This Answer Correct ?    9 Yes 32 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a shell program to test whether a given year is leap year or not ?

2256


Differevce between arrays and array builders?

1645


can we allocate memory for interface? if no then why?

1468


diffrence between oracle apps , .NET , SAP

1603


what are the missinschema properties and should we pass primary key in select command

1416






we create a pf with 3 fields.2 is defined as keyfields.we lock it with alcobj command.how we find out whether the file is locked or not?is it dspfd??/

1619


how do we provide security for web services

1802


public static void main(String args[]) describe it

1575


what does mean and stack mean in genral programming?

1441


Tag for turning an image into a hyperlink is

1835


What are the Short cut Keys of Tally ERP?

1769


I m new to the dbms. Recently i came across words clustered indexes & nonclustered indexes but i dont know what is this all about & whats the difference between them.. So please help me!!!!!!!!

1534


how can we implement locks in plsql?

1790


hi this is uday i want prepare for nic exam if any one have previous question papers please send me or atlest guide me how to prepare my ID is udaykiran4u@in.com

1471


Is anyone has done the ASP.NET MVC4 workshop course(2 days) from Peers Technologies. Let me know. I need to talk before joining ASP.NET MVC4 training at peers, Hyderabad.

1550