Pergunta de entrevista da empresa Uber

The difficulty is around leetcode medium plus.