Longest Substring Without Repeating Characters ​
Longest Substring Without Repeating Characters — LeetCode
Find the length of the longest substring that contains no repeated characters.
Approach ​
Keep a HashSet of char arrays. Keep l and r. Check if s[r] exists in the HashSet. While it exists, move the l pointer to right, and remove the s[l] from the HashSet. Once the loop exits (an element with same value as s[r] is removed), put back s[r]. Calculate maxLen = Max(maxLen, r - l + 1).