Skip to content

Commit

Permalink
Update Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdompeak authored Sep 20, 2020
1 parent 4e4eb30 commit 8a1fcda
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@
#### 解法1:固定左边界,探索右边界(开区间)
```cpp
for (int i=0; i<s.size(); i++)
{
while (count <= k)
{
while (j<n && getCount(freq, s[j]) <= k)
{
ret = max(ret, j-i);
if (j==s.size()) break;
freq[s[j]]++;
if (freq[s[j]]==1)
count++;
j++;
}
count += (freq[s[j]]==1);
j++;
}
ret = max(ret, j-i);
freq[s[i]]--;
if (freq[s[i]]==0)
count--;
count -= (freq[s[i]]==0);
}
```
Expand Down

0 comments on commit 8a1fcda

Please sign in to comment.