Vanguard interview question

Leetcode Question on Recursion/Dynamic Programming