Pergunta de entrevista da empresa RBC

Probability question, programming, finance