Count Beautiful Substrings II | Detailed Approach | Intuition | Leetcode - 2949 | Weekly Contest 373

  Рет қаралды 3,505

codestorywithMIK

codestorywithMIK

Күн бұрын

Пікірлер: 85
@rishhills
@rishhills Жыл бұрын
39:45 when MIK bro said "code bht aacche likhe hue h but pata nahi explain kyun nahi karte h..." Bhai dimaag lagta h na usme varna to sab COPY + PASTE + MODIFICATION hi h and looking at the views on this video you can see People actually m khaan intrested h 🤷 They just don't want to spend some time actually UNDERSTANDING the stuff (maybe Interview m qstn poochne vaale ko khudd itna nahi pata hota 🤣) bus cramming h or phir kehete h // bhai qstns nahi bante humse 👀 MIK bhai this is actually the USP of you and this channel that jaise aapne samjha vaisa khudd aap apni videos m as it is utaar detee ho so it's my humble equest to you NEVER EVER feel ki log dekh nahi rahe h yaa views nahi aate aisi videos p Humm jaise kucch pagal bacche hue h ab bhi jo actually m samajh k karna or seekhna chahhte h...🙏
@codestorywithMIK
@codestorywithMIK Жыл бұрын
This comment made my day. Thank you so much 🙏❤️😇 (Took screenshot of this comment) 😇❤️
@rishhills
@rishhills Жыл бұрын
@@codestorywithMIK ❤
@wearevacationuncoverers
@wearevacationuncoverers Жыл бұрын
totally agree man.
@ugcwithaddi
@ugcwithaddi Жыл бұрын
💯
@lofireverbz-wy7go
@lofireverbz-wy7go Жыл бұрын
@@codestorywithMIK that,s why i watch all the video for better concept understanding🥰🥰🥰
@noomanraza7884
@noomanraza7884 Жыл бұрын
one of the great explainer
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thanks a lot 🙏😇
@AyanSohail-oq7vk
@AyanSohail-oq7vk Ай бұрын
hats off to your dedication
@utkarshsharma1185
@utkarshsharma1185 11 ай бұрын
Thanks for the simple explanation bhai.
@codestorywithMIK
@codestorywithMIK 11 ай бұрын
Always welcome 😇❤️
@lofireverbz-wy7go
@lofireverbz-wy7go Жыл бұрын
worth watching 52 minutes ✨✨
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thank you so much ❤️🙏
@codeandtalk6
@codeandtalk6 Жыл бұрын
Thank you ❤❤❤❤❤❤❤
@codestorywithMIK
@codestorywithMIK Жыл бұрын
You are so welcome 😇❤️
@RahulBisht_001
@RahulBisht_001 Жыл бұрын
worth to watch 🎯🎯🎯🎯
@khushi6005
@khushi6005 11 ай бұрын
big shoutout, wonderful
@codestorywithMIK
@codestorywithMIK 11 ай бұрын
Thank you so much. Means a lot 😇🙏
@aadarshdontul5732
@aadarshdontul5732 4 ай бұрын
keep going brother
@rahulraj94391
@rahulraj94391 11 ай бұрын
amazing ...
@codestorywithMIK
@codestorywithMIK 11 ай бұрын
Thank you 😇🙏
@DevOpskagyaan
@DevOpskagyaan 11 ай бұрын
I think no one on KZbin or no Paid course of so called famous KZbinrs can explain like this. Hats off to this guy 🎩
@pubgfight8388
@pubgfight8388 Жыл бұрын
so beautiful so elegant just looking like a wow😀😀😀
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thank you 😅
@salmankhader1258
@salmankhader1258 Жыл бұрын
Crystal clear explanation beyond expectations
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thank you so much 🙏😇
@aditya_yt0
@aditya_yt0 Жыл бұрын
Just two words - Awesome Explanation! (btw, first time viewer).
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Welcome to my channel. Thank you so much 🙏😇
@aditya_yt0
@aditya_yt0 Жыл бұрын
​​@@codestorywithMIK Keep posting such amazing explanations. Will be a regular viewer now.
@anshukmishra4520
@anshukmishra4520 Жыл бұрын
Your dedication for teaching is on another level 🔥🔥. Thank you bhaiya.
@yashpadiyar4952
@yashpadiyar4952 Жыл бұрын
Bhaiya If possible leetcode contests ke hard questions ke videos bana diya kro naa aise hee ❤️
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Noted 😇🙏
@fashionvella730
@fashionvella730 Жыл бұрын
Please start a series on segment tree. Love from Pakistan
@thekindspill
@thekindspill Жыл бұрын
No one can explain like you. I think this is the only channel which deals with Hard problems like this and make them easy.
@ugcwithaddi
@ugcwithaddi Жыл бұрын
no one can teach like this legend
@amantripathi4100
@amantripathi4100 11 ай бұрын
keep posting man
@SinghCR7_123
@SinghCR7_123 Жыл бұрын
very easy explanantion, thanks a lot
@motivationkiaag1601
@motivationkiaag1601 Жыл бұрын
Bhaiya aap contest ke bhi solution dala karo atleast 3rd ,4th to dala hi karo isse kafi help hogi hmlogo ki .
@aws_handles
@aws_handles 11 ай бұрын
koi itna acha kaise parha sakta hai bhai. Top level content hai yaha free me.
@Omneeshkushwah9695
@Omneeshkushwah9695 Жыл бұрын
Sir I have requested to u please make a video on leetcode 1478 Allocate mailboxes
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Let me check soon
@saurabhtiwari9614
@saurabhtiwari9614 Жыл бұрын
Sir Charan kahan h aapke. Tough question ko halwa bna dya aapne.❤❤❤❤ True legend sir
@rdxrdx1792
@rdxrdx1792 6 ай бұрын
Can we take unordered_map
@rdxrdx1792
@rdxrdx1792 6 ай бұрын
Sir count in unordered_map will always be 1or 0?
@codestorywithMIK
@codestorywithMIK 6 ай бұрын
Yes, mp.count(x) returns Number of elements with key x , that is either 1 or ​0​.
@anuppatankar4294
@anuppatankar4294 Жыл бұрын
Great explanation 👌🏻
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Glad you liked it 😇🙏❤️
@rohittulasyan180
@rohittulasyan180 Жыл бұрын
Nice Explanation. But I am not sure whats the time complexity. If input is something like "ababababababababababababababababababab..............." the this is n^2. Correct me if i am wrong?
@AJ-xc3ks
@AJ-xc3ks Жыл бұрын
College se aake dekhta hu❤❤❤
@aryanshridhar8517
@aryanshridhar8517 11 ай бұрын
What exactly will be its time complexity? I assume it to be O(n*max(occurrences_of_vowels_across_map)) Can it be simplified?
@dayashankarlakhotia4943
@dayashankarlakhotia4943 Жыл бұрын
good explanation mind blowing explanation. also explain leetcode 2945
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Let me check soon.
@souravjoshi2293
@souravjoshi2293 Жыл бұрын
Hats off to your dedication. I can't believe I am able to finally understand such Hard Qns easily. Thanks to this legend.
@aadishjain2378
@aadishjain2378 7 ай бұрын
What would be the time complexity?
@ashish2438
@ashish2438 Жыл бұрын
I couldn't get why we need result += k. It should work with jaur result++ right?
@codestorywithMIK
@codestorywithMIK Жыл бұрын
result += k Ensures that we are considering all such substrings. This is exactly same as how we calculate “Find subarray count having sum 0” , in that also we don’t do result++. Just run this example with result++ and you will realise what cases we will miss. Example : s = “abba” , k = 1
@ashish2438
@ashish2438 Жыл бұрын
@@codestorywithMIK But, here we are mapping k with count of vowels, and the count of vowels will always increase as we move in the string so k should always be 1 ig
@ashish2438
@ashish2438 Жыл бұрын
Can someone explain please? 🥲
@knockcat940
@knockcat940 11 ай бұрын
​@@ashish2438 @codestorywithMIK Yes you are also right that since vow count always increase so it will work fine in doing ++ans also, but the case he want to tell about is like if we got same count let say 2 2 2 2 in vector we have 4 enteries if we have take map, but if we take map for the above thing it would be mp[pref][2] = 4 jo just in (order of 1) we will get this and our iteration will get reduces just by doing +k , here 4 count is stored in k. in the problem the thing is we will never get this case because vowel count is always on increasing we can get same (vow- con) but for that vow is always increasing so ++ans also work fine but since he explain the prior problem where we are counting subarray with sum 0 now assume what i explain above that case 2, 2, 2, 2 if we not do +k in this case, we get wrong answer becuase 2 enteires are 4 but doing ++ only 1 subarray is counted, with reference do this case + k is very imp and also this is the reason we use map of map because same thing can be done my map of vector also since we dont want to iterate for 2 2 2 2 again so he used map of map but again this case will never come so using map of vector also works fine. I hope you understand the case where +k is used.
@rdxrdx1792
@rdxrdx1792 6 ай бұрын
Same doubt have u got it?​@@ashish2438
@tutuimam3381
@tutuimam3381 Жыл бұрын
❤❤❤❤❤❤❤
@rdxrdx1792
@rdxrdx1792 6 ай бұрын
Sir do we need to memorize dsa question daily. I mean i understand this solution but do we need to revise such question whose intuition we not get directly
@codestorywithMIK
@codestorywithMIK 6 ай бұрын
Don’t revise each qn. Instead, revise topics, concepts periodically
@AliinNITW
@AliinNITW 11 ай бұрын
Why we are adding count to result instead of result++ Because every time ciunt is 1 only
@anushkathakur6531
@anushkathakur6531 Жыл бұрын
bhaiya ,agar subarrays whose summation is zero vale ques. mein agar subarrays bhi return karne bole ques. mein toh map mein index bhi store karna padega ki kab kab dekha ?? ya fir kuch aur??
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Correct you should store indices for subarray printing.
@Kumar-up2lj
@Kumar-up2lj Жыл бұрын
class Solution { public: long long beautifulSubstrings(string s, int k) { int n = s.length(); unordered_mapmp; mp[0].push_back(-1); long long pre = 0; long long ans = 0; for(int i=0;i
@ManishGupta-lz8ho
@ManishGupta-lz8ho Жыл бұрын
BHAIYA IS LEVEL TAK UNDERSTANDING LAANE KE LIYE KYA KHAANA PEENA HOGA ? CAN U SHARE UR DIET PLAN?
@sauravchandra10
@sauravchandra10 11 ай бұрын
kaafi mushkil question tha, I dont know how people come up with a solution during contests!!
@codestorywithMIK
@codestorywithMIK 11 ай бұрын
Hi there, Actually these Qns are related to many others Qns in past. Most of the people who are able to solve it during contests have solved many many many such qns and it helps them to relate and come-out with the approach to solve Qns like these. So always remember, it will come with a lot of practice and solving lots of problems. If we start solving lots of HARD and Medium problems, then you will start seeing that contest hard problems are variations of such (mostly) . for example: this week Sunday contest Qn - 4 , it was an amazing followup of already solved qn in past in my channel. This is just one example and it happens mostly to all other hard problems.
@sauravchandra10
@sauravchandra10 11 ай бұрын
Got it bhaiya, will definitely look to solve more such problems@@codestorywithMIK
@abhinavpandey3356
@abhinavpandey3356 11 ай бұрын
What is the use of storing count in the inside map? Cant we only store the vowel ct only
@ShivamYadav-vg5fv
@ShivamYadav-vg5fv 11 ай бұрын
why don't you first update map and then update the result , i.e line 37 should be at 27
@loserfruit9663
@loserfruit9663 Жыл бұрын
🔥🔥
@wearevacationuncoverers
@wearevacationuncoverers Жыл бұрын
GOAT
@yashkalia2311
@yashkalia2311 4 ай бұрын
GOAT
2949. Count Beautiful Substrings II |  Weekly Leetcode 373
38:49
codingMohan
Рет қаралды 1,7 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 89 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 213 МЛН
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 32 МЛН
Симбу закрыли дома?! 🔒 #симба #симбочка #арти
00:41
Симбочка Пимпочка
Рет қаралды 4,5 МЛН
PODEROSA ORAÇÃO DO SALMO 91 PARA QUEBRAR AMARRAS🔴
Jesus me defenda
Рет қаралды 32
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 736 М.
5682. Sum of Beauty of All Substrings
12:16
Fraz
Рет қаралды 12 М.
Unlocking Your Intuition: How to Solve Hard Problems Easily
17:34
Colin Galen
Рет қаралды 1,3 МЛН
Bitwise AND of Numbers Range | 2 Approaches | Dry Run | Leetcode 201
34:43
Sliding Window Technique - Algorithmic Mental Models
36:45
Ryan Schachte
Рет қаралды 362 М.
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 89 МЛН