Pergunta de entrevista da empresa Uber

Regular algorithm and data structure question.