https://leetcode.com/problems/longest-substring-without-repeating-characters/
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is 3. For “bbbbb” the longest substring is “b”, with the length of 1.
Solution 1: Using HashSet
1 | public class Solution { |
Solution 2: Using ASCII Code
1 | public class Solution { |
Follow Up: If you want to return the longest substring not the length of it
1 | public class Solution { |