Uber Interview Question

Hard Leetcode question related to dynamic programming.