Number of Wonderful Substrings | Clear Intuition | Full Dry Run | Leetcode 1915 | codestorywithMIK

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

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

  • @gyandyan
    @gyandyan 6 месяцев назад +28

    at 29:00 001 are present in map but you not count bcoz {b} is also a wonderful string that why answer is 4.....but very nice explaination

    • @codestorywithMIK
      @codestorywithMIK  6 месяцев назад +23

      Pinned this.
      Thanks a lot for pointing this out and apologies for the miss from my end ❤️❤️
      For more clarification :
      we have seen 001, so that means that the substring after a, ie only "b" is going to be valid substring in "ab" with 1 odd character. we add 1 to the answer in that step.

    • @aws_handles
      @aws_handles 6 месяцев назад +1

      Thanks for this

    • @shubhamdaulkar5343
      @shubhamdaulkar5343 6 месяцев назад +1

      Even i had the same doubt

    • @coder0101-su6ef
      @coder0101-su6ef 6 месяцев назад +1

      thanks bhai

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

      Thanks man

  • @Rohankumar-of2ry
    @Rohankumar-of2ry 6 месяцев назад +8

    bhai pure youtube pe is question ke solution dekh liye finally found your video what a clear explanation of every concept

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

    Your explanation is the only one which is very clear compared to most other videos on youtube

  • @AbhijeetMuneshwar
    @AbhijeetMuneshwar 6 месяцев назад +4

    Sir,
    I watched 3-4 other videos. But I couldn't understand any of them. After watching your video, I felt like this problem is so easy to understand.
    Thank you for taking your time in recording this video and teaching new techniques. 🙏🏼

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

    beautifully explained everything. even begineers can understand

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

    frankly speaking u are a gem when it comes to break the problem and build on that! you are inspiring lot of enthusiasts out there great Sir.

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

    bhai abhi just 4min pehle dekhra tha koi video cuz bitmask nai ata mko abhi 2min pehle aapne upload krdi thanks man!

  • @shivamdubey2418
    @shivamdubey2418 6 месяцев назад +1

    maine bola tha dry run ke liye thanks bhiya thanks a lot , sare questions me krwa diya kriye clearity aa jati hai

  • @Ankitkumar-fz3kc
    @Ankitkumar-fz3kc 6 месяцев назад +2

    Thanks for the video will able to understand and implement myself.

  • @YashMalav-kh1ov
    @YashMalav-kh1ov 6 месяцев назад +5

    Great as usual....btwn no apologies for not adding that 001 , sometimes in flow one can make mistake and if anybody have paid concentration since begining it wouldnt have been problem for him/her thanks❤

    • @codestorywithMIK
      @codestorywithMIK  6 месяцев назад +4

      This means a lot to me ❤️❤️🙏🙏

    • @gui-codes
      @gui-codes 6 месяцев назад +1

      yes I was able to figure out that he missed it by mistake. i followed further and understood clearly

  • @sauravchandra10
    @sauravchandra10 6 месяцев назад +4

    Bestest explanation ❤

  • @PickNick50
    @PickNick50 6 месяцев назад +2

    First of all thank you for explaining so clearly, I really appreciate your consistency and hard work.
    Secondly, can you please explain why we are taking only a to j, and excluding other character. What is the significance of this constraint.

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

      It is given in the question that characters ranges from a to j

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

      ​@@paveshkanungo6338Yes brother I can read the question, but the reasoning behind this constraint is what I want to know.

  • @GauravDuseja-t6q
    @GauravDuseja-t6q 6 месяцев назад +2

    Very good explanation thanku bhaiya

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

    After going through so many videos .. finally understand the solution.... What was the intuition behind Cumulative XOR here ? how you think it can be applied to string question? by seeing problem in start its look like sliding window problem that we have to adjust window according to the wonderful string

  • @codingkart245
    @codingkart245 6 месяцев назад +1

    Thank you so much for uploading these types of videos!

  • @hemang7309
    @hemang7309 6 месяцев назад +1

    Great explanation man , loved it ❤

  • @aws_handles
    @aws_handles 6 месяцев назад +1

    Bawal parhate ho bhai 🔥🙌

  • @supriyakashyap3295
    @supriyakashyap3295 6 месяцев назад +1

    subah se iss question ki videos dhk rhi, kisi mai kuch samajh nahi aya. I only follow you channel for DSA. I am really glad ki aapne video ittni zaldi upload kr di, i was waiting. Thankyou sir, thankyou so much.

  • @itsmepratham2712
    @itsmepratham2712 6 месяцев назад +1

    Great Explanation

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

    Thanks for the video. I wanted to ask why are we representing 'a' as 1, 'b' as 10, 'c' as 100, 'd' as 1000, and so on? What if we had taken 'a'= 1, 'b'= 10, 'c'= 11, 'd'= 100 i.e. a is corresponding to bit value of 1, b of 2 and so on?

  • @mewaconite
    @mewaconite 6 месяцев назад +1

    A very toufff question it was honestly

  • @a3rdtierguy864
    @a3rdtierguy864 6 месяцев назад +3

    Thanks bhaiya for such wonderfuk explanation got april potd badge

  • @haidarmohammad8510
    @haidarmohammad8510 6 месяцев назад +7

    At 28:59, 001 is already present on the map. Correct it to avoid confusion for other students.

    • @blipbloping
      @blipbloping 6 месяцев назад +3

      we have seen 001, so that means that the substring after a, ie only "b" is going to be valid substring in "ab" with 1 odd character. we add 1 to the answer in that step.

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

      Correct.
      See the Pinned Comment.
      Sorry to have missed that. ❤️❤️

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

    4:30 Wanted to ask why we didn't take the values of a, b, c, d in the form of integer bit values? like a= 1, b= 10, c= 11, d= 100 instead of a=1, b= 10, c= 100, d= 1000?

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

    @codestorywithMIK how much time you took to solve this problem after reading the problem statement and did you take any help

  • @manimanohar_001
    @manimanohar_001 6 месяцев назад +9

    Bro pls make a playlist on bit manipulation too like DP.😎

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

      Bro it already exists

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

    Good Explaination but this was really tough.. Although I'm bad in Xor stuff this was bouncer

  • @dipalisharma4682
    @dipalisharma4682 6 месяцев назад +1

    Got april badge alog with you and also because I of you❤🎉😊

  • @priyaaofficial7
    @priyaaofficial7 6 месяцев назад +2

    At 19:10 - 0101 we have seen in past

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

      Yes. Please refer to the Pinned comment above 😇🙏

  • @abinashdash7864
    @abinashdash7864 6 месяцев назад +1

    20:50 bhaiya,can you mention the questions. I want to practice.

  • @_Azhar-gc5kh
    @_Azhar-gc5kh 6 месяцев назад

    very nicely explaination

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

    this one was quite tough..can we get few more problems on cumulative xor if possible

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

    Best explanation bhai❤

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

    why do we represent characters by powers of 2? why not simple 1,2,3,...?

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

    Sir aapne bataya nhi ki isme sliding window ku nhi lagega please bataye ???

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

      I think the video explanation is actually a sliding window approach. Instead of cumulative sum or something, are here storing cumulative xor (in the form of bit mask)
      Correct me if I am wrong

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

    Crystal clear

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

    how to not take things on mind suppose you are doing job and simulteneosly you're doing this things as well is it ever happend that you don't want to do i think it's totally game of mind so as i ask you how to not take things on mind?

  • @GoodBoy-my8mv
    @GoodBoy-my8mv 6 месяцев назад

    Why not Sliding Window ??
    And if we shift 1 to 2 times it become 4 & shift 1 to 3 times it become 16

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

    best explanation bhaiya

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

    Hi, I am having a bit of confusion, with this problem...at timestamp 29:00 when we do 011 xor 010 we get 001, which is already present in the map which is {001: 1}, so why didn't we consider the substring "ab", also I can understand that since a and b both appear odd number of times i.e. 1, we cannot consider that substring as a wonderful substring but according to the logic of the code, we should, right? I might be wrong here or it is possible that I misunderstood or did not understand the logic clearly, but I'm having a doubt here...hope someone can help me clear it.

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

      Please see the pinned comment ❤️

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

      we have seen 001, so that means that the substring after a, ie only "b" is going to be valid substring in "ab" with 1 odd character. we add 1 to the answer in that step.

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

    Legend 🔥

  • @alisktl
    @alisktl 6 месяцев назад +3

    Bro, what language do you speak?

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

      I am from India 🇮🇳 and speak Hindi

  • @priyanshuthapliyal104
    @priyanshuthapliyal104 6 месяцев назад +1

    sir aap thooda mic quality increase kr skte toh axa rehta

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

      Hi Priyanshu,
      Actually I am currently travelling and hence I stay at different hotels/zostels etc . In order to reduce Some noise, the audio gets a little distorted. Apologies for the inconvenience.
      Will soon be fixed when I am back home ❤️❤️❤️

  • @SandeepSingh-m1h5u
    @SandeepSingh-m1h5u 6 месяцев назад

    Sir I have solved more than 550 problems on leetcode but still not able to solve new problems of medium and hard difficulty, I felt quite sad. Sometimes it seems that I am not intelligent😢😢

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

    at 28:59 we have seen in past

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

      Yes. Please see the Pinned comment above ❤️❤️

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

    seems hard for those who are newer on bit manipulation.

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

    class Solution {
    public:
    using ll = long long;
    long long wonderfulSubstrings(string s) {
    unordered_map mp;
    ll i = 0 ;
    ll curr = 0;
    ll ans = 0;
    mp[curr]++;
    ll n = s.size();
    while(i

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

      Bhai tune yeh code khud likha hai kya

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

      @@hiteshpatwal9688 ha

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

      @@tusharnanda3885 Bhai yrr tujhe acchi knowledge hogi bit masking ki koi channel suggest krrde jo yeh topic acche s krade

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

      @@tusharnanda3885 jhan s tune bhi pda ho

  • @VarunSharma-xd8xd
    @VarunSharma-xd8xd 6 месяцев назад

    the worst questions are those on strings all of them based on cramming

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

    aaj samjh nhi aaya ek video thora dry run karke ya kuch smjh aye aise banado

  • @saurabhKumar-hj6yp
    @saurabhKumar-hj6yp 6 месяцев назад +1

    ❣❣

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

    ❤❤

  • @gui-codes
    @gui-codes 6 месяцев назад

    I watched multiple videos bro but this is the only video I understood everything. Leetcode Official explanation is pathetic.

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

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

    aba ka last me kyun +1 kar dia 😁😁😁😁😁😁

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

    1st

  • @muntajir646
    @muntajir646 6 месяцев назад +1

    Best explanation😍

  • @SohailKhan-cx9gb
    @SohailKhan-cx9gb 6 месяцев назад +3

    Sir mpp.find() kyu nhi kiya if(mpp.find()) to check hm cumulative sum in sb problems me check krte h ki wo pehle se present to nhi h map me to isme kyu nhi kiya?
    SIMILAR QUESTIONS ARE # 1542. Find Longest Awesome Substring
    # 1371. Find the Longest Substring Containing Vowels in Even Counts

    • @codestorywithMIK
      @codestorywithMIK  6 месяцев назад +4

      In C++ if an element is not present, it by default returns 0. So i directly accessed it.
      But yes, you can add mp.find too

    • @SohailKhan-cx9gb
      @SohailKhan-cx9gb 6 месяцев назад

      @@codestorywithMIK thankyou sir

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

    Can you please tell why doesnt the sliding window approach work:
    class Solution {
    public:
    long long wonderfulSubstrings(string word) {

    unordered_map freq_map;
    int noOfOddFreq = 0;
    long long ans = 0;

    int left=0;
    int right =0;

    while (left

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

      I think the video explanation is actually a sliding window approach. Instead of cumulative sum or something, are here storing cumulative xor (in the form of bit mask)
      Correct me if I am wrong

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

    i want to ask that why we are calcualting the int shift = ch - 'a'; , for this cum_xor ^= (1

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

    ❤❤❤❤