Uber Interview Question

Question on Dynamic Programming