Pergunta de entrevista da empresa Microsoft

The question was a simple 2sum question