Pergunta de entrevista da empresa Merrill

Math, programming and some brain teaser.