Number Following A Pattern Leetcode Solutions