Google Interview Question

leet code hard on dynamic programming