Dynamic Programming Patterns Leetcode Python