Uber Interview Question

Solve this problem given an input and output.