Dynamic Programming Pattern Leetcode Contest Rating