Pergunta de entrevista da empresa Morgan Stanley

Nothing very basic coding question