Any · Interview · Conditional probability · practice question on a reported topic
There are three doors: a car behind one, goats behind the others. You pick a door. The host, who knows where the car is, opens another door to show a goat and offers you the chance to switch.
(a) What is your chance of winning if you switch?
Answer and worked solution
Answer: 2/3 ≈ 0.66667
Key idea. The host's reveal doesn't change the chance your first pick was right; it concentrates the rest on the other door.
Your first pick is right with probability 1/3.
The host can always open a goat door, so nothing about your door changes.
Switching wins exactly when your first pick was wrong: 2/3.
Check. Enumerate: car behind 1, 2 or 3, you pick 1. Switching wins in 2 of the 3 cases.
Trap. Answering ½ because "two doors are left". The host's choice wasn't random.
(b) Same game with 100 doors: the host opens 98 goat doors. Chance of winning if you switch?
Answer and worked solution
Answer: 0.99
Key idea. Same logic with 100 doors.
Your first pick is right 1% of the time.
The single other closed door carries the rest: 99/100.
Check. The 100-door version makes the intuition obvious.
Interviewers may push further: What if the host opened a door at random and it happened to show a goat? (Then switching wins 1/2.)
Any · Interview · Optimal stopping · practice question on a reported topic
n candidates are interviewed in random order. After each one you must hire them on the spot or reject them for good, and you can only rank each against those you've already seen. You want the single best.
(a) With n = 3, what is your best chance of hiring the best candidate?
Answer and worked solution
Answer: 0.5
Key idea. Try "reject the first, then take the first one better than everyone so far".
Rank candidates 1 (worst) to 3 (best). List the 6 orders.
The strategy hires the best candidate in 1-3-2, 2-1-3 and 2-3-1, and fails in 1-2-3, 3-1-2 and 3-2-1.
It wins in 3 of 6 orders: ½.
Check. Hiring the first candidate wins only 1/3.
(b) For large n, the best strategy (reject the first n/e, then take the next record) wins with what probability?
Answer and worked solution
Answer: 0.36788
Key idea. Reject the first r, then take the next record. Optimise r.
P(win) ≈ (r/n) ln(n/r) for large n.
Let x = r/n: maximise −x ln x. Derivative −ln x − 1 = 0 gives x = 1/e.
Value at x = 1/e: (1/e) × 1 = 1/e ≈ 0.368.
Check. Remarkably, the chance doesn't go to 0 as n grows.
Any · Interview · Probability · practice question on a reported topic
100 numbered prisoners. 100 boxes each hold one prisoner's number, shuffled. Each prisoner may open 50 boxes, alone and without communicating afterwards. All are freed only if every prisoner finds their own number. They may agree a strategy beforehand.
With the best strategy, what is the chance they all succeed?
Answer and worked solution
Answer: 0.31183
Key idea. Follow the cycle: open your own number's box, then the box named inside, and so on.
You find your number exactly when its cycle has length ≤ 50.
Everyone succeeds when the shuffle has no cycle longer than 50.
P(some cycle of length k > 50) = 1/k, and at most one such cycle exists.
Any · Interview · Logic · practice question on a reported topic
You have two identical eggs and a 100-storey building. An egg breaks if dropped from floor f or above, for some unknown f, and survives otherwise. A broken egg can't be reused.
What is the fewest drops that guarantees finding f?
Answer and worked solution
Answer: 14
Key idea. With d drops, the first drop should be from floor d, then d − 1 floors higher each time.
If the first egg breaks at floor d, test floors 1 to d − 1 one by one: d drops in total.
Each survival uses a drop, so the next jump is one floor smaller.
d drops cover d + (d − 1) + … + 1 = d(d + 1)/2 floors.
d(d + 1)/2 ≥ 100 first holds at d = 14 (105 floors).
Check. Equal jumps of 10 floors need up to 19 drops; shrinking jumps balance the worst case.
Any · Interview · Decision making · practice question on a reported topic
Two envelopes hold money, one twice the other. You open one and see $100. "The other has $50 or $200 with equal chance, worth $125 on average, so always switch." What's wrong with this argument?
Model answer
It treats "the other is double" and "the other is half" as equally likely whatever amount you see. That can't hold for every amount: no probability distribution puts equal weight on all of …, $50, $100, $200, … (the total would be infinite). Once you fix a real prior, seeing $100 does change the odds, and switching helps for some amounts and hurts for others. Before opening, the envelopes are symmetric. The fix is to name the two amounts A and 2A, rather than "X and 2X or X/2": switching gains A or loses A with equal chance, so it's worth exactly zero.