String & SubString Flashcards
1
Q
Longest substring without repeating character
A
- two pointer with one pass
- Store the i pointer with j + 1
- If map contains, get the i = max(i, get())
- Always calculate maxLength = max(maxL, j - i + 1) // + 1coz every char is substring with len 1