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

Поделиться
HTML-код
  • Опубликовано: 5 ноя 2024

Комментарии • 85

  • @rishhills
    @rishhills 11 месяцев назад +15

    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  11 месяцев назад +8

      This comment made my day.
      Thank you so much 🙏❤️😇
      (Took screenshot of this comment) 😇❤️

    • @rishhills
      @rishhills 11 месяцев назад +1

      @@codestorywithMIK ❤

    • @wearevacationuncoverers
      @wearevacationuncoverers 11 месяцев назад +1

      totally agree man.

    • @ugcwithaddi
      @ugcwithaddi 11 месяцев назад +1

      💯

    • @lofireverbz-wy7go
      @lofireverbz-wy7go 11 месяцев назад +2

      @@codestorywithMIK that,s why i watch all the video for better concept understanding🥰🥰🥰

  • @anshukmishra4520
    @anshukmishra4520 11 месяцев назад +8

    Your dedication for teaching is on another level 🔥🔥. Thank you bhaiya.

  • @thekindspill
    @thekindspill 11 месяцев назад +2

    No one can explain like you. I think this is the only channel which deals with Hard problems like this and make them easy.

  • @DevOpskagyaan
    @DevOpskagyaan 11 месяцев назад

    I think no one on RUclips or no Paid course of so called famous RUclipsrs can explain like this. Hats off to this guy 🎩

  • @AyanSohail-oq7vk
    @AyanSohail-oq7vk 21 день назад +1

    hats off to your dedication

  • @utkarshsharma1185
    @utkarshsharma1185 11 месяцев назад +3

    Thanks for the simple explanation bhai.

  • @aws_handles
    @aws_handles 11 месяцев назад

    koi itna acha kaise parha sakta hai bhai. Top level content hai yaha free me.

  • @yashpadiyar4952
    @yashpadiyar4952 11 месяцев назад +5

    Bhaiya If possible leetcode contests ke hard questions ke videos bana diya kro naa aise hee ❤️

  • @SinghCR7_123
    @SinghCR7_123 11 месяцев назад +2

    very easy explanantion, thanks a lot

  • @aadarshdontul5732
    @aadarshdontul5732 3 месяца назад +1

    keep going brother

  • @noomanraza7884
    @noomanraza7884 11 месяцев назад +2

    one of the great explainer

  • @ugcwithaddi
    @ugcwithaddi 11 месяцев назад

    no one can teach like this legend

  • @RahulBisht_001
    @RahulBisht_001 11 месяцев назад +1

    worth to watch 🎯🎯🎯🎯

  • @salmankhader1258
    @salmankhader1258 11 месяцев назад +2

    Crystal clear explanation beyond expectations

  • @aditya_yt0
    @aditya_yt0 11 месяцев назад +2

    Just two words - Awesome Explanation! (btw, first time viewer).

    • @codestorywithMIK
      @codestorywithMIK  11 месяцев назад +1

      Welcome to my channel.
      Thank you so much 🙏😇

    • @aditya_yt0
      @aditya_yt0 11 месяцев назад

      ​​@@codestorywithMIK Keep posting such amazing explanations. Will be a regular viewer now.

  • @motivationkiaag1601
    @motivationkiaag1601 11 месяцев назад +2

    Bhaiya aap contest ke bhi solution dala karo atleast 3rd ,4th to dala hi karo isse kafi help hogi hmlogo ki .

  • @pubgfight8388
    @pubgfight8388 11 месяцев назад +2

    so beautiful so elegant just looking like a wow😀😀😀

  • @souravjoshi2293
    @souravjoshi2293 11 месяцев назад

    Hats off to your dedication.
    I can't believe I am able to finally understand such Hard Qns easily. Thanks to this legend.

  • @khushi6005
    @khushi6005 10 месяцев назад +1

    big shoutout, wonderful

  • @saurabhtiwari9614
    @saurabhtiwari9614 11 месяцев назад +2

    Sir Charan kahan h aapke. Tough question ko halwa bna dya aapne.❤❤❤❤
    True legend sir

  • @amantripathi4100
    @amantripathi4100 11 месяцев назад +1

    keep posting man

  • @lofireverbz-wy7go
    @lofireverbz-wy7go 11 месяцев назад +1

    worth watching 52 minutes ✨✨

  • @rahulraj94391
    @rahulraj94391 11 месяцев назад +1

    amazing ...

  • @rdxrdx1792
    @rdxrdx1792 5 месяцев назад

    Can we take unordered_map

  • @fashionvella730
    @fashionvella730 11 месяцев назад

    Please start a series on segment tree. Love from Pakistan

  • @anuppatankar4294
    @anuppatankar4294 11 месяцев назад +2

    Great explanation 👌🏻

  • @codeandtalk6
    @codeandtalk6 11 месяцев назад +1

    Thank you ❤❤❤❤❤❤❤

  • @aadishjain2378
    @aadishjain2378 6 месяцев назад

    What would be the time complexity?

  • @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?

  • @Omneeshkushwah9695
    @Omneeshkushwah9695 11 месяцев назад +1

    Sir I have requested to u please make a video on leetcode 1478 Allocate mailboxes

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 11 месяцев назад +1

    good explanation mind blowing explanation. also explain leetcode 2945

  • @anushkathakur6531
    @anushkathakur6531 11 месяцев назад +1

    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  11 месяцев назад

      Correct you should store indices for subarray printing.

  • @rohittulasyan180
    @rohittulasyan180 11 месяцев назад

    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?

  • @rdxrdx1792
    @rdxrdx1792 5 месяцев назад +1

    Sir count in unordered_map will always be 1or 0?

    • @codestorywithMIK
      @codestorywithMIK  5 месяцев назад +1

      Yes, mp.count(x) returns Number of elements with key x , that is either 1 or ​0​.

  • @abhinavpandey3356
    @abhinavpandey3356 11 месяцев назад

    What is the use of storing count in the inside map? Cant we only store the vowel ct only

  • @AliinNITW
    @AliinNITW 10 месяцев назад

    Why we are adding count to result instead of result++
    Because every time ciunt is 1 only

  • @tutuimam3381
    @tutuimam3381 11 месяцев назад +1

    ❤❤❤❤❤❤❤

  • @AJ-xc3ks
    @AJ-xc3ks 11 месяцев назад +2

    College se aake dekhta hu❤❤❤

  • @loserfruit9663
    @loserfruit9663 11 месяцев назад +1

    🔥🔥

  • @Kumar-up2lj
    @Kumar-up2lj 11 месяцев назад

    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

  • @ashish2438
    @ashish2438 11 месяцев назад +1

    I couldn't get why we need result += k. It should work with jaur result++ right?

    • @codestorywithMIK
      @codestorywithMIK  11 месяцев назад

      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 11 месяцев назад

      @@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 11 месяцев назад

      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 5 месяцев назад

      Same doubt have u got it?​@@ashish2438

  • @ManishGupta-lz8ho
    @ManishGupta-lz8ho 11 месяцев назад

    BHAIYA IS LEVEL TAK UNDERSTANDING LAANE KE LIYE KYA KHAANA PEENA HOGA ? CAN U SHARE UR DIET PLAN?

  • @rdxrdx1792
    @rdxrdx1792 5 месяцев назад

    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  5 месяцев назад

      Don’t revise each qn.
      Instead, revise topics, concepts periodically

  • @ShivamYadav-vg5fv
    @ShivamYadav-vg5fv 10 месяцев назад

    why don't you first update map and then update the result , i.e line 37 should be at 27

  • @wearevacationuncoverers
    @wearevacationuncoverers 11 месяцев назад

    GOAT

  • @sauravchandra10
    @sauravchandra10 10 месяцев назад

    kaafi mushkil question tha, I dont know how people come up with a solution during contests!!

    • @codestorywithMIK
      @codestorywithMIK  10 месяцев назад +1

      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 10 месяцев назад

      Got it bhaiya, will definitely look to solve more such problems@@codestorywithMIK

  • @yashkalia2311
    @yashkalia2311 3 месяца назад +1

    GOAT