Recursion Leetcode Problems Python