Uber interview question

Solve this problem given an input and output.