Skip to content

Commit d017cf2

Browse files
committed
1 parent a36f537 commit d017cf2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

python/424-Longest-Repeating-Character-Replacement.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ def characterReplacement(self, s: str, k: int) -> int:
44
res = 0
55

66
l = 0
7-
maxf = 0
87
for r in range(len(s)):
98
count[s[r]] = 1 + count.get(s[r], 0)
10-
maxf = max(maxf, count[s[r]])
119

12-
if (r - l + 1) - maxf > k:
10+
while (r - l + 1) - max(count.values()) > k:
1311
count[s[l]] -= 1
1412
l += 1
1513

0 commit comments

Comments
 (0)