Dynamic Programming Template Leetcode Rating