Longest Substring Without Repeating Characters
M · mediumPracticestringssliding-window
Problem
Given a string, find the length of the longest substring that has no repeating characters.
Example
Input
abcabcbb
Output
3
Sliding window + HashSet. Expand right pointer; when duplicate found, shrink left pointer.
Longest substring without repeat: "abc" (length 3)