Leetcode Maximum Recursion Depth Exceeded While Pickling