Loading...
linty@sh ~>
longest-substring-without-repeating-characters
#002
medium
string
algorithm
sliding-window
description
Given a string s, find the length of the longest substring without repeating characters.
Example:
-
Input:
s = "abcabcbb" -
Output:
3(the substring is"abc", which has length 3) -
Input:
s = "bbbbb" -
Output:
1(the substring is"b", which has length 1)
instructions
- Return the length of the longest substring (an integer)
- The substring must be contiguous
- No characters should repeat within the substring
test cases
Input:
"abcabcbb"Expected:
3Input:
"bbbbb"Expected:
1Input:
"pwwkew"Expected:
3Loading...
longest-substring-without-repeating-characters
#002
medium
string
algorithm
sliding-window
description
Given a string s, find the length of the longest substring without repeating characters.
Example:
-
Input:
s = "abcabcbb" -
Output:
3(the substring is"abc", which has length 3) -
Input:
s = "bbbbb" -
Output:
1(the substring is"b", which has length 1)
instructions
- Return the length of the longest substring (an integer)
- The substring must be contiguous
- No characters should repeat within the substring
test cases
Input:
"abcabcbb"Expected:
3Input:
"bbbbb"Expected:
1Input:
"pwwkew"Expected:
3