Pergunta de entrevista da empresa Microsoft

One of the questions I got was a coding problem that tested both algorithmic thinking and code quality.