Uber interview question

Algorithms