Pregunta de entrevista de Morgan Stanley

Nothing very basic coding question