Snap Interview Question

Dynamic programming and recursion question