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
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.
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.
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 ❤🎉
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.
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; }
June End take 45k Karva dean plsss ❤🫂
Continuous Subarray Sum (Similar Problem) - th-cam.com/video/1W_HYBqvDLw/w-d-xo.html
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
bro you teach reallyyyyyyyyy well. I did exactly all of this mistakes in the same proceducre what you explained before correct solution.
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 .
subscribing you from this vidoe..loved the explanantion
Aryan Mittal, I really enjoyed this video, so I hit the like button!
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.
Thank You So Much Brother !! Keep it up , plz don't stop to make great video !! it's helpful for beginners..
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.
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 ❤🎉
was just doing this problem lol.....vaise bhaiya aap Twitter pe active kyu nhi rehte ?
Well explained🙌🙌
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.
wow your videos are very helpful thank youuu
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;
}
Inthis case rem will come negative after adding k right ?
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!
Loved it❤
I did exactly same mistakes you discussed 😂 , even step by step
Aryan you are great 🫨
The arrays you showed were same, where i stuck.
1:37 9:35 if I had a voice crack like that in my interview I would reschedule it for next year. xD
genius bro 😅😅😅😅😅😅😅😅😅😅
Bro leetcode laggy chal rha hai aaj bahut. is it just me or for everyone?
yeah same
oh shit noooo i broke my pc because of that lag
same bro
thank you
Yes it is definitely medium hard in my opinion 🫠🥲