src.longest_subs_no_repeat¶
Classes
|
- class src.longest_subs_no_repeat.Solution[source][source]¶
- lengthOfLongestSubstring(s: str) int [source]¶
Thought process¶
Basic sliding window concept
We move
l
left if we notice a repeated letters[r]
untill the condition is no longer violatedIf the repeated condition is not violated
l
is stationary marking the start of our substring and we grow the sliding window from the right side withr
Two key things to know here are : sliding window approach with left and right pointers sliding across our array, character map
Notes¶
time complexity : \(O(n)\)
space complexity : \(O(n)\) because of
subs
hashset