Uber Interview Question

How can you find a more optimal solution