Largest Subarray with 0 Sum GFG

class Solution:
    def maxLen(self, arr):
        cmax = 0
        csum = 0
        cache = {0: -1}
        for ix, n in enumerate(arr):
            csum = csum + n
            if csum in cache:
                cmax = max(cmax, ix - cache[csum])
            cache[csum] = cache.get(csum, ix)
        return cmax