by crntaylor · 12y ago · 0 comments
A the beginning, there's a 1/1000 chance that you pick a double-headed, and a 999/1000 chance you pick a fair coin.
A fair coin would act the way you've observed 1/1024 times. A double-headed coin would act that way 100% of the time.
(This is where I get fuzzy): Given what you've observed, there is a (1000+1024)/1024 = 0.506 chance that the coin is double-headed. There is a 0.494 chance that it's fair.
A double-headed coin would come up heads next 100% of the time. A fair coin would come up heads 50% of the time. So, 0.506 x 1 + 0.494 x 0.5 = 0.753.
How far off am I?
Anyway--assume I think all that aloud in an interview. What does that tell you about the candidate?
I would give points for just asking that question, because many people bound by conventional thinking wouldn't dare to ask it, accepting default assumption that you can't. I'm not saying this says anything about your ability to solve the problem, but asking the question is a good sign of a supple mind.
There's a .999 chance you have a fair coin and a .001 chance you have the rigged coin.
(0.999 * 0.5) + (0.001 * 1) = 0.5005.
Seems too simple, but a coin is a coin, right?
So figure the p(heads) for the coin and ignore the previous history. Overthinking it is why this makes a good FizzBuzz problem.