diff --git a/OJ notes/pages/Leetcode Longest-Substring-Without-Repeating-Characters.md b/OJ notes/pages/Leetcode Longest-Substring-Without-Repeating-Characters.md index 07d7190..ceab974 100644 --- a/OJ notes/pages/Leetcode Longest-Substring-Without-Repeating-Characters.md +++ b/OJ notes/pages/Leetcode Longest-Substring-Without-Repeating-Characters.md @@ -69,6 +69,8 @@ similar to this one. The goal is making cur as small as possible, without duplicating +And the localMax is max(localMax, i - cur) + ### Solution Kadane's algorithm @@ -90,6 +92,7 @@ public: } hMap[s[i]] = i; + // The char at cur is ignored localMax = max(localMax, i - cur); } return localMax;