Skip to content

Commit 740f69c

Browse files
author
lucifer
committed
fix: 简化代码
1 parent 2086178 commit 740f69c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

problems/424.longest-repeating-character-replacement.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ class Solution:
112112
for j in range(len(s)):
113113
counts[ord(s[j]) - ord("A")] += 1
114114
most_fraq = max(most_fraq, counts[ord(s[j]) - ord("A")])
115-
while i < j and j - i + 1 - most_fraq > k:
115+
if i < j and j - i + 1 - most_fraq > k:
116116
counts[ord(s[i]) - ord("A")] -= 1
117-
most_fraq = max(most_fraq, counts[ord(s[j]) - ord("A")])
118117
i += 1
119118
return j - i + 1
120119
```

0 commit comments

Comments
 (0)