Pergunta de entrevista da empresa Niantic

Typical leetcode style coding question.