Leetcode Recursion And Stack Overflow Python