comefrom: <doocs>0525.Contiguous Array_1.py
code: 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
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_2 = var_1 = 0
      var_3 = { 0 : - 1 }
      for var_4 , var_5 in enumerate ( var_0 ) :
          var_2 += 1 if var_5 == 1 else - 1
          if var_2 in var_3 :
              var_1 = max ( var_1 , var_4 - var_3 [ var_2 ] )
          else :
              var_3 [ var_2 ] = var_4
      return var_1
  