Description:

Solution:

We use set() for substring. (Sliding Window)
In example 1, the string is abcabcbb.
We are gonna store substring until meet duplicated character.
abc -> now we meet "a"
Remove the first "a", now new substring is bca.
The length of substring should be r - l + 1.
Time Complexity: O(n)
Space Complexity: O(n)
'LeetCode 🏔️ > String' 카테고리의 다른 글
20. Valid Parentheses (0) | 2023.06.18 |
---|---|
49. Group Anagrams (0) | 2023.06.17 |
242. Valid Anagram (0) | 2023.06.16 |
76. Minimum Window Substring (0) | 2023.06.15 |
424. Longest Repeating Character Replacement (0) | 2023.06.14 |
Description:

Solution:

We use set() for substring. (Sliding Window)
In example 1, the string is abcabcbb.
We are gonna store substring until meet duplicated character.
abc -> now we meet "a"
Remove the first "a", now new substring is bca.
The length of substring should be r - l + 1.
Time Complexity: O(n)
Space Complexity: O(n)
'LeetCode 🏔️ > String' 카테고리의 다른 글
20. Valid Parentheses (0) | 2023.06.18 |
---|---|
49. Group Anagrams (0) | 2023.06.17 |
242. Valid Anagram (0) | 2023.06.16 |
76. Minimum Window Substring (0) | 2023.06.15 |
424. Longest Repeating Character Replacement (0) | 2023.06.14 |