Your question is Longest Substring Without Repeats. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Write an algorithm to find the longest substring without repeating characters.
Implement the function below. Given a string s, return the length of its longest contiguous substring in which every character appears at most once. Return 0 for an empty string. The solution should run in linear time.
Function: def length_of_longest_substring(s):
Example: s = "abcabcbb" returns 3, because "abc" is the longest valid substring.
def length_of_longest_substring(s):