Cool riddles that supposedly come from Microsoft's interview process:
- You're outside the door to a room with 3 light bulbs. The door to it is closed. On the wall next to the door are 3 light switches, each corresponding to one of the light bulbs inside. You need to identify which switch goes to which bulb, but once you open the door to look you are not allowed to touch the switches again. How do you do it?
Solution (highlight):
If we call the switches A, B, and C, flip on A, wait a minute, then flip off A and flip on B. The warm bulb that is off is A, the one that's on is B, and the one that's off is C. - Before you are 2 jars. You have 100 marbles: 50 blue and 50 red. A jar will be picked at random, and then a marble picked at random from that jar. Assuming that every marble is used, how would you distribute the marbles to maximize the chance of getting a red marble? What is that probability?
Solution (highlight):
Short version: Put one red marble in the first jar and all the rest in the second jar. Long version: If there are x reds and y blues in jar 1, then the probability of getting a red marble is x/2(x+y) + (50-x)/2(100-x-y). Since y appears in the denominators only, clearly we want y=0. The resulting expression is minimized for x=1 (we can't have both x and y equal to 0 in this formula). The probability in this case is 0.7474 (repeating).
