Uber Interview Question

Regular algorithm and data structure question.