Pergunta de entrevista da empresa Microsoft

A problem based on 2 pointers