Pergunta de entrevista da empresa Uber

Asked me to solve a leetcode problem