Great Explaination I got stuck in the logic but after watching till Logic I can directly code without watching Line by Line Code part. please don't stop uploading such awesome contents :)
almost similar approach but without using set int findSubString(string s) { // Your code goes here int n = s.size(); int left = 0, right = 0; int ans = INT_MAX; unordered_map orig, freq; int uniqueChar = 0; for(int i = 0; i < n; ++i){ orig[s[i]] = 1; } uniqueChar = orig.size(); int cnt = 0; while(right < n){ freq[s[right]]++; if(freq[s[right]] == 1) ++cnt; while(cnt == uniqueChar){ ans = min(ans, right - left + 1); --freq[s[left]]; if(freq[s[left]] == 0) --cnt; ++left; } ++right; } return ans; }
guys use this code if TLE is appearing int findSubString(string str) { set st; for(char c: str){ st.insert(c); } unordered_map mp; int i=0,j=0,ans=str.size(),n=st.size(); while(i1){ mp[str[j++]]--; } ans=min(ans,i-j+1); } i++; } return ans; }
Code CPP:
sets; unordered_mapm;
for(char c:str)
s.insert(c);
int i =0, j = 0, ans = str.size(), n = s.size();
while(i1) m[str[j++]]--;
ans = min(ans, i-j+1);
}
i++;
}
return ans;
Big fan madam 😊
what if there is no such sub string exist and we have to print -1
@@khushil9988 it will not happens, max chance is to get ans as length of str.
please update your code its give TLE
This is amazing dry run of code and thank you so much
Great Explaination
I got stuck in the logic but after watching till Logic I can directly code without watching Line by Line Code part.
please don't stop uploading such awesome contents :)
Ma'am aap bahot acha padhati ho, Istarted falling in love with your coding.
shi bol rhe ekdam
Your Code explanation on compiler is osm
almost similar approach but without using set
int findSubString(string s)
{
// Your code goes here
int n = s.size();
int left = 0, right = 0;
int ans = INT_MAX;
unordered_map orig, freq;
int uniqueChar = 0;
for(int i = 0; i < n; ++i){
orig[s[i]] = 1;
}
uniqueChar = orig.size();
int cnt = 0;
while(right < n){
freq[s[right]]++;
if(freq[s[right]] == 1)
++cnt;
while(cnt == uniqueChar){
ans = min(ans, right - left + 1);
--freq[s[left]];
if(freq[s[left]] == 0)
--cnt;
++left;
}
++right;
}
return ans;
}
brilliant explanation
Thanks for explaining intuition & debugging
Keep making such videos
Thanks.
Excellent explanation mam. Thank you so much 😍
This channel deserve more popularity.
you explain so well,thank you so much!
thanks for the detailed explanation!!!
Crystal clear explanation mam, all concepts cleared
Great explanation with help of dry run
thanks for such an easy explanation
Best explanation 👌 I've found on yt❤
Thanks Parveen for making this! What a solution!
Very nice explanation....
thank you so much
great explanation 💯💯💯💯💯💯
Thanku so much didi for great explanation
Keep the good work coming. Thanks
wonderful explanation
your teaching style is very lovely mam plzz make more tutorials its really amazing😇😇😇
Its really awesome🔥🔥🔥
nice explanation but it gave TLE
Great explanation mam!
Great Explaination Dii❤❤❤❤❤❤
Great explanation 👏👏👏👏
😍😍 Great Explanation
Very good!
Similar code but bit different in if i replace while
sets;
unordered_mapmp;
for(int i=0;i
Keep up the awesome work alisha
worst case ,will it give O(n^2) ?
but required is O*(256*n)
please clearify it
Gosh you are so underrated.
guys use this code if TLE is appearing
int findSubString(string str)
{
set st;
for(char c: str){
st.insert(c);
}
unordered_map mp;
int i=0,j=0,ans=str.size(),n=st.size();
while(i1){
mp[str[j++]]--;
}
ans=min(ans,i-j+1);
}
i++;
}
return ans;
}
use unordered_set to avoid TLE
@@UmashankarYadavJE thanks bro
while(1){
cout
good explanation
Thank You Beautiful, Your explantion is as beautiful as you are. Thanks a lot
great explanation!!!!!!!!!!!!!
Thanks didi
Thankyou so much
what for bCC string
and for CaABBA
Good
Thanks
Thank u
Getting TLE
Rehne do Didi mene solve kar liya Unordered_set use karke😅
int findSubString(string str)
{
sets;
for(int i=0;i
use unordered set
greatt
Do u have any another social media I'd accept from linked i need to connect u there .
age of urs
🎀🙂
tum ittni sundar ho mai kya karu ?
Or tum kya ho??
I want to marry u because to say that my wife is a master in DSA JUST FOR FUN 🥰
beautiful Explanation