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!
The official answer to this riddle is turn switch 1 on for a minute or so, switch it off then switch 2 on. if the bulb is hot but dark, its 1, if it’s lit it’s 2 and if it’s out and cold its 3.
the adult answer is why do I have only one chance to walk in the room?
So I can’t go to the other room to set up a camera?
What if it’s a LED bulb?
LED bulbs do get warm, not as hot as incandescent bulbs but they do emit heat. You might have to run them longer than a minute to warm it up enough to be immediate about it.
“First, I would get a label maker and ask a coworker to assist me. Then, we’d work together to quickly figure out what each switch does, and then label them accordingly. In a business of this size and reputation, documenting your work and synergistic teamwork are foundational to value and growth.”
Then, reject whatever offer they send and say that it’s because they showed you a workplace culture that enabled middle management to test employees with busywork instead of minding their own business or solving their own damn trivial problems.
Here’s my answer that works with any kind of lightbulb.
Flip switch 1 on, switch 2 off, and get switch 3 stuck in a halfway point which I’ve done on both lever switches and flat switches.
If it’s on it’s switch 1, if it’s off it’s switch 2, if it’s flickering or dimmed it’s switch 3 and you should probably turn it off to stop damaging the relay.
Trying to get a switch stuck half way sounds like a good way to start a fire. If the bulb is dimmed, that means not all the power is making it to the bulb, and half of it is probably going into heating up the switch contacts. It could also be arcing inside the switch, which will also destroy the contacts. I think some new building codes require “arc fault protection” on circuits for this type of reason, in addition to “ground fault protection” (GFCI) on bathroom/kitchen circuits.
I would say, I do enjoy riddles, so this will be fun. But I am concerned that if you think my skill at riddles is critical, that it may mean your management has gotten used to not fully thinking through the objectives they give and how those objectives interact with the existing systems or other objectives. That would result in the kind of product that looks like the right hand doesn’t know what the left is doing. If that is your reasoning for the question, how is the company countering it to create a coherent product.
And the reason I might say this is tgat in my experience, companies who ask such questions aren’t the kind I want to work for.
Literally ask someone which switch it is. Then ask them what idiot wired them up that way
I’d walk into the other room first and drop a mirror in the hallway on my way back so I could see lmao. My employer wouldn’t want me touching a hot bulb since that might be a workplace hazard they’d be liable for after training me with stupid riddles.
I’ll look through the door.
Or, set up a webcam to see when the light is on.
If this isn’t allowed somehow, I’ll tell the building management to consider rewiring this absolutely cursed light switch situation ASAP because it’s gotten so bad that it’s being used as a brainteaser by the recruiting department
After reading the incandescent bulb solution, and problems regarding touching the bulb, i would switch first switch on for a appreciably long time, such that bulb has hit maximum luminousity (they heat up as they run, the hotter they get, the brighter they are), then turn switch off, and turn second switch on and quicky run to other room. we are trying to observe change in luminousity as time elapses. if it reduces, it was first (we ran it for a long time, there would be some residual glow, from my irl observations from when i was small suggest roughly 1 min period where i can still tell, but bulb wattage, contrat with background and distance matter). if increasing or max luminous, then second, if nothing then third.
but it was a stupid question. my naive guess was it can not be done, because with just 1 binary observation, you can not tell from 3 switches (you need atleast 2, which the solution assumes as temp and light state, i substitute heat with light state in transition). but still stupid. my natural assumption was leds, even when i head incandascent bulbs in my house somewhere for nearly half of my life. it is also stupid, because when you allow me to do something i was mentioned in question to do, i could just bend my way to do anything. like punch/drill through wall, or hack surveillance systems, or just pull out my handy multimeter that i always have on me, open switch box and see which switch is live, which is dead, or see voltage/current/wattage change across the loop, or measure resistance and guess what thing is there, or like blackmail the interviewer to extract the answer.
You’re almost there. Turn the first one on for a while. Then then it off and turn the second one on and run to the room. There are theee possible scenarios. If the bulb is on, switch 2 controls it. If the bulb is hot but off switch 1 controls it. If the bulb is cold and off, switch 3 controls it.
i know this solution, but many problems are there, what if it is in a ceiling fixture, or enclosed in something such that i can not know the temp (hot or cold), then i can still observe luminosity changes. if you feel your eyes do a bad job, get a camera properly color and temp caliberated, and just focus on filament (now auto exposure or temperature adjustment).
tl:dr i am still trying to poke holes in this thermocol wall of defence.
deleted by creator
Ok. The classic answer is “turn on the first switch for five minutes. Then turn switch 1 back off, turn on the second switch and go in the room immediately. If the light is hot, it’s controlled by switch 1; if it’s on, it’s controlled by switch 2; if it’s off and cold it’s controlled by switch 3.”
Except that a light bulb in 2025 is very likely to be an LED bulb, so it wouldn’t actually get hot. At least not hot enough to feel even a few moments later. And in a corporate setting (this is classically an interview question), the switch has been more likely to control a fluorescent tube, which can get hot, but typically not as quickly as an incandescent one.
My answer, if I were in an interview, would be to ask questions (Chesterton’s Fence).
-
First of all, why do we have the one-visit limit? Is this a prod light bulb? We need a dev light bulb environment, with the bulbs and switches in the same room. (While we’re making new environments, let’s get a QA and regression environment, too. Maybe a fallback environment, depending on SLAs.)
-
Second, what might the other switches do? What’s the downside to just turning them all on? If that’s not known, why not? What is the risk? For that matter, do we know that only one switch needs to be turned on to turn on the light, or is it possible that the switches represent some sort of 3-bit binary encoding?
-
Third, why were the switches designed this way? Can they be redesigned to provide better feedback? Or simplified to a single switch? If not, better documentation (labeling) is a must.
-
Fourth, we need to reduce the length of the feedback loop. A five minute test and then physically going to touch the bulb is way too long. Let’s look into moving the switches or the light in our dev environment so that the light can be seen from the switches.
-
Impossible even if you know if the light is on or off to start with. Even then, there are 2 possible outcomes which means the solution space halves on each test. 3 divided by 2 is greater than 1 (1.5) so we cannot figure it out in a single test.
That’s my recollection of how to solve these from computer science. The classic one is 8 coins and figuring out which one weighs a different amount (and you don’t know if it is more or less). You have a scale that tells you which side is heavier (or equal) but it doesn’t give readouts (as in it doesn’t say a side is X pounds/grams). With only three uses of the scale, how can you find the fake coin? I’m not going to go into the process in depth but because you have THREE outcomes (left heavier, equal, and right heavier) you reduce the solution space (which of the 8 coins is the bad one) by a THIRD each test. The number 8 sort of lures into thinking powers of 2. You can actually do it with 9 coins in 3 tests.
Some of the details of my explanation may be wrong, it’s been over a decade since I took that class in college lol. It was my worst professor (while different story lol) but I distinctly remember him talking about this. He had a very thick accent, some form of eastern European or Russian, I’m not really sure what exactly. But he gave us that problem as homework or something or maybe just to think about. And he’d ask us to explain how we’d do it. Whenever someone began to describe something doing like test 4, 2, etc instead of the correct way (which involves using coins you already tested) he’d say “YOU’RE DOOMED!” Then someone else would try, and when they got to a way that wouldn’t work “YOU’RE DOOMED!” It was hilarious. Very memorable.
Hint: the solution depends on a more realistic and physics-based model of the problem than you’re using. And, even bigger hint, it’s less intuitive now that light bulb technology has changed to become much more efficient, you should imagine this problem taking place with a '90s bulb.
Yeah, after reading the answers I see it more clearly. Also, I assume in hindsight that it’s three switches which can be on or off, so we know if all three are off the light is off. Which helps as well.
Also the number of outcomes isn’t connected to the solution space reduction the way you say. If you don’t know whether the fake coin is heavier or lighter, both tilt-right and tilt-left are effectively the same result. So at least your first test really only has 2 meaningful outcomes.
In general, you’ll only reduce your solution space DOWN TO (not by) 1/(number of distinguishable outcomes) if the possible solutions are evenly divided among those outcomes. It’s easy to have a problem where “result 1 narrows it down a lot, result 2 doesn’t tell us much”
Like I said, it’s been over a decade, some of the specifics may be lost to me.
If you don’t know whether it’s heavier or lighter, after the first test shows uneven you still have 6 coins possible. You can do it in 3 tests only if you know lighter vs heavier for the fake coin.
YOU’RE DOOMED! You must weigh four against four in the first step.
Building codes, at least the ones I am aware of, require the light switch inside the room with the light next to the door, similar to how nearly every room you have ever been in. (Everyone knows of exceptions.) This means either corners have been cut, at those switches should control things within the room with the switches.
As the interviewer if attention to detail and following build codes and specifications is important at this company. Is there a culture of safety, or are corners cut that put my life at risk.
if asked this I would go into a complicated explanation of how I would dismantle the switches to identify if they were functioning first because of sub-par outsourced manufacturing standards.
they’d probably attempt to move on to a different question, but I would always bring it back to those shoddy light switches.
“so do you have any questions for us?”
yeah, do you know who the manufacturer of the light switches are? it’s probably Leviton, but I’m hoping it’s Honeywell because they’re far superior in quality. you see Leviton uses brass plated contacts vs Honeywell uses full brass fittings that don’t cause resistance and increases the potential for fires. are you aware that using one brand over another could reduce your insurance costs by up to 3%?
You’ve had some cowboys in here
Ha! Easy! Go in the other room and take a picture of the bulb. Now go back to the switches and flip each one in order, while looking at the picture. When the picture of the bulb shows it lit up, that’s the switch.
I don’t understand. You don’t need to visit a room to know whether the light is on in it.
This is the real answer. If there is a light switch that turns on a light in a room, rarely ever would you not see the results of switching it on from where the switch itself is located. Visiting the room is a red herring.










