Room with 3 Bulbs | Adobe Interview

Imagine you are in a room with 3 switches. In an adjacent room there are 3 bulbs (all are off at the moment), each switch belongs to one bulb. It is impossible to see from one room to another. How can you find out which switch belongs to which bulb, if you may enter the room with the bulbs only once?

Variant 2————–
There are 3 switches outside of a room, all in the ‘off’ setting. One of them controls a lightbulb inside the room, the other two do nothing.
You cannot see into the room, and once you open the door to the room, you cannot flip any of the switches any more.Before going into the room, how would you flip the switches in order to be able to tell which switch controls the light bulb?






Solution :

Its known that all 3 switches are in OFF position.

So I switch one bulb on and since time is not a concern for me I wait for 
5 mins during which any bulb becomes warmer to touch than a bulb which is 
switched off.

Then I switch it off(ie switvh off the switch).
I then switch on another switch. Then I rush to the other room to infer that 
the glowing bulb and warm bulb and cold bulb correspond to which switches.

Variant 2 ------------------

Flip the first switch and keep it flipped for five minutes. Then unflip it, 
and flip the second switch. Go into the room. If the lightbulb is off but warm, 
the first switch controls it. If the light is on, the second switch controls it. 
If the light is off and cool, the third switch controls it.

Leave a Reply

Your email address will not be published. Required fields are marked *

For Inserting code :
Paste your code in the comment form, select it and then click the language link

C | C++ | Java |