graduate analyst interview questions shared by candidates
If you were in a room with three light switches, and you could not see out of the room and you could only leave the room once. The three corresponding light bulbs are in another room. How do you tell which light switches belong to which bulbs?
Assumptions: You have three inputs: X, Y, Z with two possible states (0,1). You have three outputs: A,B,C with two possible states (0,1). The inputs and outputs are independent of each other, but one input should be matched to one output. For example, if X --> A, then X(1) --> A(1). Note: we don't actually know whether the normal state of the switch is open or closed. For our purposes 0 is normal state, 1 is abnormal state. You have one chance to observe the outputs. You could flip one of the switches and observe, but this will only tell you about one of the connections and leave two unknowns. You could flip two switches, but this still leaves two unknowns. You could flip all three, but this leaves three unknowns. You could flip none of them, but that leaves three unknowns. Another possibility is to McGyver the light switches by placing three resistors of different values in series with the switch, verifying the switch is closed, and then observe the relative brightnesses of the bulbs. More creatively, you could use your one trip to leave the room to find the documentation and/or the persons responsible for this cruel experiment. I am sure this is wrong, but I was never a math or CS major. =D
(I mean you would put one resistor in series with each of the three switches, obviously; the greatest value resistor would result in the most dimming).
My answer to this is: Assign a value to each light switch (A,B,C) Start a timer for 3 minutes Flip switch A and B on After the 3 minutes is up, flip B off again. Go into the other room. The lighting bulb belongs to switch A The the other two light bulbs (one will be hot and one will be cold) The hot bulb belongs to switch B The cold bulb belongs to switch C.