Problem
Given a string, find the length of the longest substring without repeating characters.
Examples
1 | Input: "abcabcbb" |
1 | Input: "bbbbb" |
1 | Input: "pwwkew" |
Solution1
Method: Two Pointers
Time Complexity: O(n)
Space Complexity: O(n)
1 | class Solution: |
or
1 | class Solution: |
or
1 | class Solution: |
Solution2
Method:
Data Structures: Dictionary
Time Complexity:
Space Complexity:
1 | class Solution: |
Solution3
Method: Dynamic Programming
Time Complexity: O(n)
Space Complexity: O(n)
1 | class Solution: |