From bbcd5e02d59b443919a030b1c2c8b9a981d6b7d9 Mon Sep 17 00:00:00 2001 From: juan Date: Thu, 14 Jul 2022 10:09:31 +0800 Subject: [PATCH] vault backup: 2022-07-14 10:09:31 --- .../Leetcode Longest-Substring-Without-Repeating-Characters.md | 3 +++ 1 file changed, 3 insertions(+) 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;