File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
src/main/java/g0001_0100/s0003_longest_substring_without_repeating_characters Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ 3\. Longest Substring Without Repeating Characters
2
+
3
+ Medium
4
+
5
+ Given a string ` s ` , find the length of the ** longest substring** without repeating characters.
6
+
7
+ ** Example 1:**
8
+
9
+ ** Input:** s = "abcabcbb"
10
+
11
+ ** Output:** 3
12
+
13
+ ** Explanation:** The answer is "abc", with the length of 3.
14
+
15
+ ** Example 2:**
16
+
17
+ ** Input:** s = "bbbbb"
18
+
19
+ ** Output:** 1
20
+
21
+ ** Explanation:** The answer is "b", with the length of 1.
22
+
23
+ ** Example 3:**
24
+
25
+ ** Input:** s = "pwwkew"
26
+
27
+ ** Output:** 3
28
+
29
+ ** Explanation:** The answer is "wke", with the length of 3. Notice that the answer must be a substring, "pwke" is a subsequence and not a substring.
30
+
31
+ ** Example 4:**
32
+
33
+ ** Input:** s = ""
34
+
35
+ ** Output:** 0
36
+
37
+ ** Constraints:**
38
+
39
+ * ` 0 <= s.length <= 5 * 104 `
40
+ * ` s ` consists of English letters, digits, symbols and spaces.
You can’t perform that action at this time.
0 commit comments