11 prisoners arrive at a jail.

But this jail is not an ordinary jail, it's a jail whose Warden despises ignorance and reveres wisdom. So much so, that the Warden is willing to free the group of prisoners if they can solve the puzzle the Warden gives them.

When the prisoners arrive, the Warden announces the puzzle.

"In my jail, there is a switch room and 11 solitary confinement cells. I've just cleaned them out so don't trash the place.

Anyway, after today, I will take you all and put you in your confinement cells, without any possible communication between any of you. During the your confinement, whenever I feel like it, I will randomly pick one of you and take you to the switch room.

The switch room has two switches - A and B. They are not connected to anything, but they can either be in an ON or OFF position. I will not tell you their current positions.

The person in the switch room has to reverse the position of one of the switches, and only can reverse the position of one of the switches. Then I will take that person out and put them in their confinement cell. I will not touch the switches, or mess with them in any way.

All this time, the switch room is not visible from the outside, and there will be no trickery like leaving messages or anything. If you try anything fishy, I'll land you in toilet duty for the next month.

I can pick one of you thrice in a row to go to the switch room, or jump around and come back. I, however, will still make it possible for you to finish the puzzle - just not telling you when.

Now, at any point in time, any of you can come up to me and claim that all of you have visited the switch room. If you are right, then you can all go free and cake will be served. If you are wrong, then all of you will have to clean out my bedroom for the rest of your term (it makes me shudder to even think about it).

I will give you the next 24 hours before I put you in solitary confinement to make a plan"

How can the prisoners guarantee an escape plan without risking a fate worse than death?

  • 2
    $\begingroup$ It's the 100 prisoners and light bulb problem, isn't it? $\endgroup$
    – ABcDexter
    Commented Jun 9, 2016 at 13:34
  • $\begingroup$ Nope. It's totally different. I'm... actually not quite sure why you drew the straight distinction between the two. $\endgroup$
    – Mildwood
    Commented Jun 9, 2016 at 13:36
  • $\begingroup$ Ok, I'll try to solve it :) $\endgroup$
    – ABcDexter
    Commented Jun 9, 2016 at 13:37
  • $\begingroup$ Weird I thought I saw this puzzle here before - I remember trying to solve it, must have been elsewhere. $\endgroup$ Commented Jun 9, 2016 at 13:53
  • 2
    $\begingroup$ Any strategy that works for the lightbulb problem also works for this problem by treating the first switch as the lightbulb: if the prisoner would toggle the lightbulb, they toggle the first switch, otherwise they toggle the second switch. $\endgroup$
    – f''
    Commented Jun 9, 2016 at 14:32

1 Answer 1


I got it..

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

Here is the rest

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 at their very first opportunity, and again on the second opportunity. If the first switch is already up, or they have already flipped the first switch up two times, they will then flip the second switch. Only the leader may flip the first switch down, 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 20 times, he announces that all have visited the room.

And Again,

It does not matter how many times a prisoner has visited the room, in which order the prisoners were sent or even if the first switch was initially up. Once the leader has flipped the switch down 20 times then the leader knows everyone has visited the room. If the switch was initially down, then all 10 prisoners will flip the switch up twice. If the switch was initially up, then there will be one prisoner who only flips the switch up once and the rest will flip it up twice.


The prisoners can not be certain that all have visited the room after the leader flips the switch down 11 times, as the first 6 prisoners plus the leader might be taken to the room 12 times before anyone else is allowed into the room. Because the initial state of the switch might be up, the prisoners must flip the first switch up twice. If they decide to flip it up only once, the leader will not know if he should count to 10 or 11.

I actually have seen this puzzle before. Thus, a quick answer.

  • 1
    $\begingroup$ I solved this puzzle some years ago and I remember struggling for hours before solving the problem of the counter not knowing if he was first or not. $\endgroup$ Commented Jun 9, 2016 at 13:55
  • 1
    $\begingroup$ I remember One of my friends gave me this puzzle, I didn't solve it at that time. He told me the answer at that time. Imagine my ego taking a hit. I then, spent hours doing my best and finally coming to the answer. Thus, I answered this quick coz i remembered the idea. $\endgroup$
    – Sid
    Commented Jun 9, 2016 at 13:57
  • $\begingroup$ Nicely done. Found myself here after being presented with a similar problem elsewhere and googling for the answer. At first I thought your solution was overkill and that the mission could be accomplished with only one flip of the first switch for each non-leader, but as I worked that out I found that two are, in fact, required. It might be nice to update this answer to explain that aspect. $\endgroup$
    – JakeRobb
    Commented Jan 10, 2018 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.