<qiyuangong>076_Minimum_Window_Substring_1.py
def minWindow( s, t):
    ls_s, ls_t = len(s), len(t)
    need_to_find = [0] * 256
    has_found = [0] * 256
    min_begin, min_end = 0, -1
    min_window = 100000000000000
    for index in range(ls_t):
        need_to_find[ord(t[index])] += 1
    count, begin = 0, 0
    for end in range(ls_s):
        end_index = ord(s[end])
        if need_to_find[end_index] == 0:
            continue
        has_found[end_index] += 1
        if has_found[end_index] <= need_to_find[end_index]:
            count += 1
        if count == ls_t:
            begin_index = ord(s[begin])
            while need_to_find[begin_index] == 0 or\
                has_found[begin_index] > need_to_find[begin_index]:
                if has_found[begin_index] > need_to_find[begin_index]:
                    has_found[begin_index] -= 1
                begin += 1
                begin_index = ord(s[begin])
            window_ls = end - begin + 1
            if window_ls < min_window:
                min_begin = begin
                min_end = end
                min_window = window_ls
    if count == ls_t:
        return s[min_begin: min_end + 1]
    else:
        return ''
def sample_funcname ( var_0 , var_1 ) :
    var_3 , var_4 = len ( var_0 ) , len ( var_1 )
    var_7 = [ 0 ] * 256
    var_8 = [ 0 ] * 256
    var_9 , var_11 = 0 , - 1
    var_13 = 100000000000000
    for var_15 in range ( var_4 ) :
        var_7 [ ord ( var_1 [ var_15 ] ) ] += 1
    var_17 , var_18 = 0 , 0
    for var_19 in range ( var_3 ) :
        var_20 = ord ( var_0 [ var_19 ] )
        if var_7 [ var_20 ] == 0 :
            continue
        var_8 [ var_20 ] += 1
        if var_8 [ var_20 ] <= var_7 [ var_20 ] :
            var_17 += 1
        if var_17 == var_4 :
            var_21 = ord ( var_0 [ var_18 ] )
            while var_7 [ var_21 ] == 0 or var_8 [ var_21 ] > var_7 [ var_21 ] :
                if var_8 [ var_21 ] > var_7 [ var_21 ] :
                    var_8 [ var_21 ] -= 1
                var_18 += 1
                var_21 = ord ( var_0 [ var_18 ] )
            var_22 = var_19 - var_18 + 1
            if var_22 < var_13 :
                var_9 = var_18
                var_11 = var_19
                var_13 = var_22
    if var_17 == var_4 :
        return var_0 [ var_9 : var_11 + 1 ]
    else :
        return ''
