(string)
return max_length, sub_string
Find the length of the longest substring
    without repeating characters.
    Return max_len and the substring as a tuple
Find the length of the longest substring
    without repeating characters.
    Return max_len and the substring as a tuple
Find the length of the longest substring without repeating characters . Return max_len and the substring as a tuple
def get_longest_non_repeat_v1(string):
    """
    Find the length of the longest substring
    without repeating characters.
    Return max_len and the substring as a tuple
    """
    if string is None:
        return 0, ''
    sub_string = ''
    dict = {}
    max_length = 0
    j = 0
    for i in range(len(string)):
        if string[i] in dict:
            j = max(dict[string[i]], j)
        dict[string[i]] = i + 1
        if i - j + 1 > max_length:
            max_length = i - j + 1
            sub_string = string[j: i + 1]
    return max_length, sub_string
def get_longest_non_repeat_v1 ( string ) : if string is None : return 0 , '' sub_string = '' dict = { } max_length = 0 j = 0 for i in range ( len ( string ) ) : if string [ i ] in dict : j = max ( dict [ string [ i ] ] , j ) dict [ string [ i ] ] = i + 1 if i - j + 1 > max_length : max_length = i - j + 1 sub_string = string [ j : i + 1 ] return max_length , sub_string