0003 Longest Substring Without Repeating Characters
Warning
This post is more than a year old. Information may be outdated.
Solved at: 230130 Longest Substring Without Repeating Characters - LeetCode
Question
Given a string s, find the length of the longest substring without repeating characters.
Solution
Results
- Time taken: 6 m 48 s
- Runtime 645 ms, Beats 9.21%
- Memory 14.8 MB, Beats 43.95%
Complexity Analysis
We can use an array to make this
We can replace candidate.count != Set(candidate).count to using Sets to check in time, given at one given point must have distinct characters.
Backlinks1
Coding TestsComments