Dynamic Programming Pattern Leetcode Solutions With Explanation