Uber interview question

Easy coding question. Hard case study