You are viewing a single comment's thread. Return to all comments →
easy c++ approach string isValid(string s) { vectorv(26,0); int freq = 0; for(int i=0;i
if(cnt==freq-1){ v[b-'a']--; } cnt = 0; for(int i=0;i<26;i++){ if(v[i]!=0){ if(v[i]!=a){ cnt++; } } } if(cnt==1 || cnt==0){ return "YES"; } else{ return "NO"; }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Higher Than 75 Marks
You are viewing a single comment's thread. Return to all comments →
easy c++ approach string isValid(string s) { vectorv(26,0); int freq = 0; for(int i=0;i
}