Identifying the Correct Switch for a Light Bulb

Finding light bulb switch with four switches is a medium quant interview question on Brain Teasers.

Difficulty Medium Topic Brain Teasers

This brain teaser presents a simple physical setting with switches and a hidden light bulb, but the logical structure mirrors more abstract information problems. You need to design a strategy that uses limited, costly observations of the hidden state (what you see when you enter the room) to identify which of several controllable inputs is responsible for an outcome. The twist is that you may manipulate the switches freely while outside, but the revealing observation only happens when you step inside, so the challenge is to encode as much information as possible into each visit. Variants of this style of puzzle are popular in tech and quantitative interviews to probe structured thinking under constraints.

Solving it leans on combinatorial reasoning, state encoding, and planning under limited probes of a system. Strong answers recognize that you are effectively designing an experiment: using time, persistence, or intermediate states to distinguish otherwise indistinguishable controls. Interviewers listen for candidates who systematically catalogue possible worlds, map them to distinct observations, and minimize the number of observations needed. They are also looking for clear articulation of the strategy, justification that it is optimal, and awareness of how the method might generalize to more switches or different constraints.

What it tests

This problem class is governed by the principle of privacy-preserving aggregation, where a group wants to compute a function of their private inputs (like the sum or average) without revealing the individual values. The key is to use random masking or secret sharing: each participant adds a random number (a 'mask') to their input before sharing, and the protocol is designed so that these masks cancel out in the final computation. This works because the sum of all masked inputs, minus the sum of all masks, yields the true sum, while no individual mask or input is exposed. The pattern holds because linear operations (like addition) are compatible with distributed masking, and as long as the random numbers are kept secret, no participant can infer another's input from the masked data. This approach is foundational in secure multiparty computation, where trust is distributed and privacy is preserved through clever algebraic structure.

Practise this question with written feedback, or hear it in a spoken mock interview.

Get started free