From d1d387e84cc64ccf07b6b836c84ffde63e406e5d Mon Sep 17 00:00:00 2001 From: David Date: Mon, 14 Aug 2023 21:03:45 -0400 Subject: [PATCH] fix increment error --- algorithm/sliding_window.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/algorithm/sliding_window.py b/algorithm/sliding_window.py index 222dec1..214b8bc 100644 --- a/algorithm/sliding_window.py +++ b/algorithm/sliding_window.py @@ -22,7 +22,7 @@ def sliding_window_template_with_examples(s, p): # loop the source string from begin to end while end < len(s): - counter[s[end]] += 1 + counter[s[end]] -= 1 # update count based on some condition if counter[s[end]] > 1: count += 1 @@ -49,4 +49,4 @@ def sliding_window_template_with_examples(s, p): return res -# refer to https://leetcode.com/problems/minimum-window-substring/discuss/26808/here-is-a-10-line-template-that-can-solve-most-substring-problems \ No newline at end of file +# refer to https://leetcode.com/problems/minimum-window-substring/discuss/26808/here-is-a-10-line-template-that-can-solve-most-substring-problems