comefrom: <doocs>0697.Degree of an Array_1.py
code: def findShortestSubArray( nums: List[int]) -> int:
      mapper = {}
      for i, v in enumerate(nums):
          if v in mapper:
              arr = mapper[v]
              arr[0] += 1
              arr[2] = i
          else:
              arr = [1, i, i]
              mapper[v] = arr
      max_degree = min_len = 0
      for arr in mapper.values():
          if max_degree < arr[0]:
              max_degree = arr[0]
              min_len = arr[2] - arr[1] + 1
          elif max_degree == arr[0]:
              min_len = min(min_len, arr[2] - arr[1] + 1)
      return min_len
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_1 = { }
      for var_2 , var_3 in enumerate ( var_0 ) :
          if var_3 in var_1 :
              var_4 = var_1 [ var_3 ]
              var_4 [ 0 ] += 1
              var_4 [ 2 ] = var_2
          else :
              var_4 = [ 1 , var_2 , var_2 ]
              var_1 [ var_3 ] = var_4
      var_6 = var_5 = 0
      for var_4 in var_1.values ( ) :
          if var_6 < var_4 [ 0 ] :
              var_6 = var_4 [ 0 ]
              var_5 = var_4 [ 2 ] - var_4 [ 1 ] + 1
          elif var_6 == var_4 [ 0 ] :
              var_5 = min ( var_5 , var_4 [ 2 ] - var_4 [ 1 ] + 1 )
      return var_5
  