mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-04 05:37:38 +00:00
docs(docs): rename variable to window and add Longest Repeating Character Replacement page
This commit is contained in:
1 parent
217e899281
commit
31f89dd4f5
2 files changed
+51
-4
No files matched your search
@@ -35,12 +35,12 @@ class Solution:
|
||||
def lengthOfLongestSubstring(self, s: str) -> int:
|
||||
left = 0
|
||||
ans = 0
|
||||
seen = set()
|
||||
window = set()
|
||||
for right, c in enumerate(s):
|
||||
while c in seen:
|
||||
seen.remove(s[left])
|
||||
while c in window:
|
||||
window.remove(s[left])
|
||||
left += 1
|
||||
seen.add(c)
|
||||
window.add(c)
|
||||
ans = max(ans, right - left + 1)
|
||||
|
||||
return ans
|
||||
|
||||
Reference in new issue
Block a user