Pregunta de entrevista de Uber

Asked me to solve a leetcode problem