Pergunta de entrevista da empresa IMC Trading

Basic algorithm questions, can be done in any language.