this post was submitted on 25 Dec 2025
244 points (97.3% liked)

Programmer Humor

39640 readers
566 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS
 

Post:

You have three switches in one room and a single light bulb in another room. You are allowed to visit the room with the light bulb only once. How do you figure out which switch controls the bulb? Write your answer in the comments before looking at other answers.


Comment:

If this were an interview question, the correct response would be "Do you have any relevant questions for me? Because have a long list of things that more deserving of my precious time than to think about this!

you are viewing a single comment's thread
view the rest of the comments
[–] Skyline969@lemmy.ca 78 points 4 days ago (2 children)

Only works if it’s an incandescent light, but…

Flip one switch. Wait a few minutes. Flip it off.

Flip the second switch and go into the room.

If the light is on, it’s the switch you flipped most recently. If the light is off but warm, it was the first switch. If it’s off and cold, it’s the switch you didn’t touch.

[–] cmnybo@discuss.tchncs.de 27 points 4 days ago (1 children)

Only works if it’s an incandescent light

LED and fluorescent lights get hot too, it just takes a bit longer.

[–] AnnaFrankfurter@lemmy.ml 17 points 4 days ago (1 children)

Yeah like few hours longer. And if I'm asked that I'll force the interviewer to sit through until it gets warm

[–] mech@feddit.org 4 points 3 days ago

You don't have to narrate your solution in real time.

[–] Tolookah@discuss.tchncs.de 9 points 4 days ago

You can visit the room once, doesn't say you can't swap the bulb for a smart bulb and use your phone to figure it out when it enters pairing mode...