Pergunta de entrevista da empresa Bloomberg

The coding question was not hard.