Pergunta de entrevista da empresa Morgan Stanley

Code, Probability, a tricky stats question