Pregunta de entrevista de RBC

Probability question, programming, finance