Basic Dynamic Programming Leetcode Problems Python