<doocs>0525.Contiguous Array_1.py
def findMaxLength( nums: List[int]) -> int:
    s = ans = 0
    mp = {0: -1}
    for i, v in enumerate(nums):
        s += 1 if v == 1 else -1
        if s in mp:
            ans = max(ans, i - mp[s])
        else:
            mp[s] = i
    return ans
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_5 = var_3 = 0
    var_7 = { 0 : - 1 }
    for var_9 , var_10 in enumerate ( var_0 ) :
        var_5 += 1 if var_10 == 1 else - 1
        if var_5 in var_7 :
            var_3 = max ( var_3 , var_9 - var_7 [ var_5 ] )
        else :
            var_7 [ var_5 ] = var_9
    return var_3
