974. Subarray Sums Divisible by K | PrefSum | Not an Easy Problem

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 28

  • @ARYANMITTAL
    @ARYANMITTAL  5 หลายเดือนก่อน +10

    June End take 45k Karva dean plsss ❤🫂
    Continuous Subarray Sum (Similar Problem) - th-cam.com/video/1W_HYBqvDLw/w-d-xo.html

    • @relax143
      @relax143 5 หลายเดือนก่อน

      bro in today''s leetcode weekly contest third problem why cant we solve it with ( dp+binary search) i am getting runtime error.
      instead of index+1 iam finding upperbound of x

  • @tarungupta8668
    @tarungupta8668 5 หลายเดือนก่อน +2

    bro you teach reallyyyyyyyyy well. I did exactly all of this mistakes in the same proceducre what you explained before correct solution.

  • @bharathkumar9645
    @bharathkumar9645 5 หลายเดือนก่อน +1

    exactly what i did to solve the problem , the same approach as to check divisible by k and then using absolute value and so on .

  • @harshitmnnit
    @harshitmnnit 5 หลายเดือนก่อน +5

    subscribing you from this vidoe..loved the explanantion

  • @IOSALive
    @IOSALive 5 หลายเดือนก่อน +5

    Aryan Mittal, I really enjoyed this video, so I hit the like button!

  • @rushikeshmhatre1243
    @rushikeshmhatre1243 5 หลายเดือนก่อน

    This modulus case is for C++/C/Java. Python handles the scenario where you get (-1 % 2 = 1). So if you are doing the problem in python there is no need to add k.

  • @Sumeet_100
    @Sumeet_100 5 หลายเดือนก่อน +3

    Thank You So Much Brother !! Keep it up , plz don't stop to make great video !! it's helpful for beginners..

  • @Zomb-zj4ip
    @Zomb-zj4ip 5 หลายเดือนก่อน

    I would like to thank you so much for this detailed explanation. I have hated prefix sum but today I understood each and every topic. I can say confidently that you have a better teaching concept than some of the biggest channels on yt , which finally helped me understand . Thank you for going in depth.

  • @nanibramhasamudram6044
    @nanibramhasamudram6044 5 หลายเดือนก่อน

    I thought it was same as contiguous sub array problem and went into implementation part and failed and came here great explanation btw thank you bro for the amazing contest we are learning a lot from you ,you are putting great efforts ❤🎉

  • @badrirao6472
    @badrirao6472 5 หลายเดือนก่อน +3

    was just doing this problem lol.....vaise bhaiya aap Twitter pe active kyu nhi rehte ?

  • @AshishDochaniaBMT
    @AshishDochaniaBMT 3 หลายเดือนก่อน

    Well explained🙌🙌

  • @surajjoshi5503
    @surajjoshi5503 5 หลายเดือนก่อน

    Hi Aryan, the video is really great one.
    Just one thing when you mentioned about the negative numbers. Ideally, -2 % 6 can be -2 or 4 but it really depends on the language being used. Modulus operators' result is wound back in languages such as in Python. Like in Python -2 % 6 = 4 not -2. Hence this part is hugely dependent on the language being utilized. Hence the analysis will not be consistent over all languages.

  • @_AnuragsinghThakur
    @_AnuragsinghThakur 5 หลายเดือนก่อน

    wow your videos are very helpful thank youuu

  • @AtharvaChauhan-ye7yu
    @AtharvaChauhan-ye7yu 5 หลายเดือนก่อน

    just add k to the remainder when it becomes negative🙌
    int subarraysDivByK(vector& nums, int k)
    {
    int n = nums.size();
    int res = 0;
    unordered_map mp;
    int sum = 0;
    mp[0] = 1;
    for (int i = 0; i < n; i++)
    {
    sum += nums[i];
    int rem = sum % k;
    if (rem < 0) {
    rem += k;
    }
    res += mp[rem];
    mp[rem]++;
    }
    return res;
    }

    • @santhanakrishnan3128
      @santhanakrishnan3128 5 หลายเดือนก่อน

      Inthis case rem will come negative after adding k right ?

  • @tanishkarawat5266
    @tanishkarawat5266 5 หลายเดือนก่อน

    Hey Aryan! stalked your linkedIn and got to know that you are from meerut. I'm also from meerut. Would love to meet u once in person!

  • @shaleen9434
    @shaleen9434 5 หลายเดือนก่อน

    Loved it❤

  • @ayush.8545
    @ayush.8545 5 หลายเดือนก่อน

    I did exactly same mistakes you discussed 😂 , even step by step

  • @karanwagh4829
    @karanwagh4829 5 หลายเดือนก่อน

    Aryan you are great 🫨
    The arrays you showed were same, where i stuck.

  • @idiomz4104
    @idiomz4104 5 หลายเดือนก่อน

    1:37 9:35 if I had a voice crack like that in my interview I would reschedule it for next year. xD

  • @factsworlda2k547
    @factsworlda2k547 5 หลายเดือนก่อน

    genius bro 😅😅😅😅😅😅😅😅😅😅

  • @kergeysarjakin5592
    @kergeysarjakin5592 5 หลายเดือนก่อน +2

    Bro leetcode laggy chal rha hai aaj bahut. is it just me or for everyone?

  • @UECAshutoshKumar
    @UECAshutoshKumar 5 หลายเดือนก่อน +1

    thank you

  • @rajrajesh1669
    @rajrajesh1669 5 หลายเดือนก่อน +1

    Yes it is definitely medium hard in my opinion 🫠🥲