Need help, works fine on my desktop. Doesn't work on leetcode -> error

I dont know why it's giving me an error RecursionError: maximum recursion depth exceeded in comparison

It works just fine on my desktop, but on leatcode gives an error, maybe someone could lit a light ?

class Solution:
    def canReach(self, arr: List[int], start: int) -> bool:
        
        iVisited = set();
        def ft_iterate(currIndex):
            if currIndex < 0 or currIndex >= len(arr) or currIndex in iVisited:
                return False;
            if arr[currIndex] == 0: return True;
            iVisited.add(start);
            
            return ft_iterate(currIndex + arr[currIndex]) or ft_iterate(currIndex - arr[currIndex]);
        return ft_iterate(start)

Comments (2)