Smallest Number Following Pattern Leetcode Python Compiler