Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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?

Answers were Sorted based on User's Feedback



This is a puzzle question .... The warden meets with 23 new prisoners when they arrive. He tells..

Answer / mahesh shiwani

The team nominates a leader. The group agrees upon the
following rules:

The leader is the only person who will announce that
everyone has visited the switch room. All the prisoners
except for the leader will flip the first switch up when
possible, but only for their first two visits to the room.
If the first switch is already up, or they have already
flipped the first switch twice, they will then on flip the
second switch. Only the leader may flip the first switch
down, and if the first switch is already down, then the
leader will flip the second switch. The leader remembers how
many times he has flipped the first switch down. Once the
leader has flipped the first switch down 44 times, he
announces that all have visited the room. It does not matter
how many times a prisoner has visited the room, in which
order the prisoners were sent or even if the switch was
flipped up by the warden. In the example of three prisoners,
the leader must flip the first switch down four times to be
sure all prisoners have visited the room.

Is This Answer Correct ?    29 Yes 14 No

This is a puzzle question .... The warden meets with 23 new prisoners when they arrive. He tells..

Answer / adrian may

They all have to signal twice, because the first signal the
caller sees might just have been that the warden left the
switch on to begin with. In that case he'll see 45
altogether if he waits long enough. But maybe the switch
was off to begin with and he only gets 44. If one prisoner
had never been in, the most the caller could see is 43. If
each prisoner only signals once, you can't tell if somebody
is still waiting when you see 22.

Is This Answer Correct ?    5 Yes 1 No

This is a puzzle question .... The warden meets with 23 new prisoners when they arrive. He tells..

Answer / z

the problem is that the leader will never know whether the
switch was up or down at the beggining. So he has to wait
until he will switch it down 23 times(or 45, because if its
only 44 he wont know if the last prisoner has visited the
switch room, its the same thimg).But in case the switch was
down at the beginning he will have to wait forever for the
23th or 45th time and that will never happen. So there's no
way with this solution that he can be absolute sure(except
ofcourse if one day he switches it down for the 23th or 45th
time respectively)

Is This Answer Correct ?    1 Yes 1 No

This is a puzzle question .... The warden meets with 23 new prisoners when they arrive. He tells..

Answer / pawan

THere are two cases : 1) switch 1 is on and 2)switch 1 is
off. And all except leader will on the first switch if it of
only during their first visit. The position of second switch
i not necessary. 1st case : If the leader goes first he will
make the switch off. so the remaining if goes will turn it
on...so 22 will be wrong because leader started with it so
he cannot be sure after turning off 22 times that all have
visited because therse possibility that one of them have not
visited. If leader does not go first then 22 is enough ...to
be same he tells after 23 switches......case 2: it doesnt
matter if leader is sent first or later...after 23 he can
safely say all have visited

Is This Answer Correct ?    0 Yes 0 No

This is a puzzle question .... The warden meets with 23 new prisoners when they arrive. He tells..

Answer / dave peck

The team nominates a leader. The group agrees upon the
following rules:

The leader is the only person who will announce that
everyone has visited the switch room. All the prisoners
except for the leader will flip the first switch up when
possible, but only for their first visit to the room.
If the first switch is already up, or they have already
flipped the first switch twice, they will then on flip the
second switch. Only the leader may flip the first switch
down, and if the first switch is already down, then the
leader will flip the second switch. The leader remembers how
many times he has flipped the first switch down. Once the
leader has flipped the first switch down 23 times (once for
each of the other 22 prisoners, and once just in case it
started in the up position), he announces that all have
visited the room. It does not matter how many times a
prisoner has visited the room, in which order the prisoners
were sent or even if the switch was
flipped up by the warden.

Is This Answer Correct ?    1 Yes 3 No

This is a puzzle question .... The warden meets with 23 new prisoners when they arrive. He tells..

Answer / 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

More Programming Languages AllOther Interview Questions

what is the draw back of Power builder

0 Answers   IBM,


What is diffrent between Method and and function in c#

0 Answers  


What is BASIS

0 Answers  


what is delegate and how works delegate and event.

0 Answers   NIIT,


hii I inntrested abt scjp certification but i dont knw abt scjp plz send details abt scjp exam and syllabus.

0 Answers  


When we have two versions of the dot net installed how does the compiler know which version of DLL it has to select to an application.

0 Answers   Tesco,


WHAT IS MAIN IMPORTANT THING IN SOFTWARE?

0 Answers   Infosys,


1. How many jobs can we write in a single file? 2. How many maximum members can exist in a single partition data set(pds) in jcl?

0 Answers   Steria,


Building Quotation engine program

5 Answers   Wipro,


could u please also write an example of a code that involves instances from an abstract class just as u did for interfaces because u said it could also work which i really doubt. thanks

0 Answers  


how to stop execution of step 3 in a job mainframe

0 Answers  


What are the tasks performed by a Team Lead

0 Answers   Emphasis,


Categories