Skip to content

Commit 6bec51f

Browse files
authored
Update smallestdistinctwindow.cpp
1 parent dfd4e3b commit 6bec51f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Strings/smallestdistinctwindow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using namespace std;
99
string smallestWindow(string s,string p){
1010
unordered_map<char,int> freqp;
1111
for(char c:p){
12-
freqp[c]++; #taking in every character of the partial string
12+
freqp[c]++; //taking in every character of the partial string
1313
}
1414
int distinct=freqp.size();
1515
unordered_map<char,int> freqw;
@@ -20,9 +20,9 @@ string smallestWindow(string s,string p){
2020

2121
while(r<s.length()){
2222
while(r<s.length() && count<distinct){
23-
freqw[s[r]]++; #taking in the main string
23+
freqw[s[r]]++; //taking in the main string
2424
if(freqp.find(s[r])!=freqp.end() && freqw[s[r]]==freqp[s[r]]){
25-
count++; #if the char matches than count increased
25+
count++; //if the char matches than count increased
2626
}
2727
r++; #increment uptil the main string length
2828
}
@@ -31,7 +31,7 @@ string smallestWindow(string s,string p){
3131
ans=r-l;
3232
li=l;
3333
ri=r;
34-
flag=true; #setting the flag true if window found
34+
flag=true; //setting the flag true if window found
3535
}
3636
freqw[s[l]]--;
3737
if(freqp.find(s[l])!=freqp.end()&& freqw[s[l]]<freqp[s[l]]){

0 commit comments

Comments
 (0)