Domanda di colloquio di Uber

Regular algorithm and data structure question.