Uber interview question

Algorithms Coding