<doocs>0697.Degree of an Array_1.py
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
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_3 = { }
    for var_5 , var_6 in enumerate ( var_0 ) :
        if var_6 in var_3 :
            var_7 = var_3 [ var_6 ]
            var_7 [ 0 ] += 1
            var_7 [ 2 ] = var_5
        else :
            var_7 = [ 1 , var_5 , var_5 ]
            var_3 [ var_6 ] = var_7
    var_12 = var_11 = 0
    for var_7 in var_3.values ( ) :
        if var_12 < var_7 [ 0 ] :
            var_12 = var_7 [ 0 ]
            var_11 = var_7 [ 2 ] - var_7 [ 1 ] + 1
        elif var_12 == var_7 [ 0 ] :
            var_11 = min ( var_11 , var_7 [ 2 ] - var_7 [ 1 ] + 1 )
    return var_11
