<qiyuangong>904_Fruit_Into_Baskets_1.py
def totalFruit( tree):
    basket, res, start = 2, 0, 0
    queue_map = {}
    for i, v in enumerate(tree):
        queue_map[v] = queue_map.get(v, 0) + 1
        if len(queue_map) > 2:
            queue_map[tree[start]] -= 1
            if queue_map[tree[start]] == 0:
                del queue_map[tree[start]]
            start += 1
        res = max(res, i - start + 1)
    return res
def sample_funcname ( var_0 ) :
    var_2 , var_4 , var_5 = 2 , 0 , 0
    var_6 = { }
    for var_8 , var_9 in enumerate ( var_0 ) :
        var_6 [ var_9 ] = var_6.get ( var_9 , 0 ) + 1
        if len ( var_6 ) > 2 :
            var_6 [ var_0 [ var_5 ] ] -= 1
            if var_6 [ var_0 [ var_5 ] ] == 0 :
                del var_6 [ var_0 [ var_5 ] ]
            var_5 += 1
        var_4 = max ( var_4 , var_8 - var_5 + 1 )
    return var_4
