Suppose that you are standing in a hallway next to 3 light switches, which are all off. There is another room down the hallway, where there are 3 incandescent light bulbs – each light bulb is operated by one of the switches in the hallway. Because the light bulbs are in another room, you can not see them since you are standing in the hallway.

How would you figure out which switch operates which light bulb, if you can only go the room with the light bulbs one time, and only one time?

 

A lot of times it helps just to state the obvious, so let’s do that here:
If a switch is in the ‘on’ position then the light bulb corresponding to that switch will light up as well.

Now, given the previous information, can we solve this problem? Well, just think about the different possibilities. If we have all switches on, then when we go into the attic all the light bulbs will be on. This tell us nothing about which switch corresponds to which light bulb. If we have 2 of the switches on, then when we go into the attic, 2 of the light bulbs will be on. This will tell us that the switch which is in an ‘off’ position corresponds to the light bulb that’s off in the attic. And if we have 1 switch on (and the other 2 off), then we know which switch corresponds to the light bulb that’s on.

Neither of the last 2 solutions are complete – because they only tell us about one of the switches and the light bulb that it corresponds to. But the problem clearly states that we need to know about all three of the switches, and which bulb each one corresponds to.

Think outside the box

So it’s now obvious that we must find some other way of solving the problem. Let’s ‘think outside the box’: what else do we know here?

Well, the properties of a switch don’t seem to have anything unique to them – they are just either simply on or off.

What happens to a light bulb when turned on?

What about the light bulbs? Well, we do know that incandescent light bulbs get hot when they are on – this sounds like it might just lead to something useful that can help us. We know that the longer an incandescent light bulb stays on the hotter it gets.

So, if we turn one switch off after 5 minutes, turn the second one on, and leave the last one off then what happens? Well, the light bulb corresponding to the first switch will still be warm (even though it’s off), the bulb corresponding to the second switch will be on, and the bulb corresponding to the last switch will be off. This is enough information so that we can go into the attic only once and figure out which switch belongs to which light bulb.

This question is tricky – because it requires thinking somewhat ‘creatively’ to come up with a solution. Measuring someone’s intelligence based on a problem like this is probably not a good idea – whether people stumble open an answer to this is often due to their luck. Unless, of course, they already knew the answer.

Hiring? Job Hunting? Post a JOB or your RESUME on our JOB BOARD >>

Subscribe to our newsletter for more free interview questions.

17 thoughts on “three-switches-three-bulbs”

WordPress › Error

There has been a critical error on your website.

Learn more about debugging in WordPress.