Leetcode 856 Python Recursive Problems