Given a string s, find the length of the longest substring without repeating characters.
Run through the entire string, checking every character. At every character, iterate to the end of the string. While the current character has not already appeared since the initial character, add to the length.
For every character in the string:
Get the current character and add to the list of visited characters.
While there are still characters left in the string:
Get the next character to compare.
Check that the character is not a repeat.
If the character is not a repeat, add to the visited list.
Add to the current length.
If the character is a repeat, exit the while loop.
Check if the current length is longer than the longest length so far and reassign as necessary.
Return the longest length.
For example: str = "aaabde"
i = 0; curr = 'a'; compare = 'a'; current_length = 1; longest_length = 1; visited = ['a']
The current_length = 1 because the 1st and 2nd character in str are both 'a', so there is a substring of length 1 --> 'a'
i = 1; curr = 'a'; compare = 'a'; current_length = 1; longest_length = 1; visited = ['a']
Do not update longest_length because the new current_length is the same value as longest_length
i = 2; curr = 'a'; compare = 'b'; current_length = 2; longest_length = 1; visited = ['a', 'b']
Do not update longest_length yet because the compare character is not the same as the curr character.
Add 'a' and 'b' to the list of visited characters.
i = 2; curr = 'a'; compare = 'd'; current_length = 3; longest_length = 1; visited = [a', 'b', 'd']
Do not update longest_length yet because the compare character does not appear in the visited array.
Add 'd' to the list of visited characters.
i = 2; curr = 'a'; compare = 'e'; current_length = 4; longest_length = 4; visited = ['a', 'b', 'd', 'e']
Update longest_length because there are no more characters left to search.
Add 'e' to the list of visited characters.
i = 3; curr = 'b'; compare = 'd'; current_length = 2; longest_length = 4; visited = ['b', 'd']
i = 3; curr = 'b'; compare = 'e'; current_length = 3; longest_length = 4; visited = ['b', 'd', 'e']
i = 4; curr = 'd'; compare = 'e'; current_length = 2; longest_length = 4; visited = ['d', 'e']
i = 5; curr = 'e'; compare = null; current_length = 1; longest_length = 4; visited = ['e']