Interview Question

Financial Software Developer Interview New York, NY

There is a panel containing 3 light switches in front of

  you. Each switch controls a light in a room somewhere. Doesn't really matter where. You can play with the switches as much as you like, but you're only allowed to enter the room once. How do you tell which switch controls which light? Again, you can only enter the room once, so you cannot play with the switches after you enter the room, but you can play with them as much as you want before you enter the room. One entry is all it takes to determine which switch controls which light.

Interview Answer

4 Answers


Think about it for a bit...
Here's a hint: the lights start off, and they've been off for a long time.

Interview Candidate on Jun 28, 2012

turn on switches 1 and 2, turn off switch 3. Check room 1. Easy path: the light is off, its switch is # 3. turn off switch 1 and go to room 2, if ligth is on the its switch is # 2 otherwise is switch 1. Interesting path: light is on in room 1, turn off switch 2 and go to room 2, then you get 2 options: light is on, its switch is # 1, if light is off then switch 1 controls room 1... just complete the other options, that's easy.

ektor on Sep 12, 2012

Take the hint. Key part is that you can play with the lights as long as you want. Flip on a light an leave it on for a long time. Flip it off, and turn on another one. Walk into the room. If the light is on, it was that switch. If it is off and warm, it was the first switch. Otherwise, it is the untouched switch

Mikhail on Oct 9, 2012

Switch on the 1st one and switch it off, then switch on the 2nd one and go in the room to check if the light is on. If it is on it means it's the 2nd one, and if it's not touch the light to check if it's hot. If it's hot it means the 1st switch is the correct one as it was switched on once or else it's the 3rd one.

pratik on Dec 13, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.