Uber interview question

Exercise