You are the only one jo ye pahle batate ho ki socha kaise jata h. Fir prove krte ho. Yhi reason hai ki apki videos baki youtube videos se better hoti h. Or aapke concept dekhne k baad mere ko code dekhne ki need aaj tk nhi hui.
I don't care how many subscribers or views you have. But you always have the best way of explaining questions. this is absolute luxury to have all this for free.
Make daily videos bhaiya , it will help me to crack companies , my interview is scheduled and if I watch your video daily , i will definetly crack good companies , bcoz same I will going to explain in Interview starts from brute force to optimised. please keep uploading video daily !
Probably the best channel for learning the concept rather than the code Bhaiya confidence hai ki agar aapke saath daily LeetCode problems karte raha to kuch hi dino me pura pura khud se solve kar paunga Thanks for being there on youtube sharing all your knowledge
for anyone wondering about the school division concept : In modular arithmetic, the remainder is always a non-negative number less than the divisor. So (-4 % 7 would be = 3). you are thinking right. but In C++ (idk about other languages), the modulus operation with a negative dividend retains the sign of the dividend. Therefore, when you compute -4 % 7, the result will be -4
Hey Brother , I watch your videos daily and I just want to tell you that You are doing great work . Keep it up 🤗 . Love From Gujarat ❣. Thank you for the daily videos. 🙌
Two amazing concepts : 1,2,3.....n.......m 1) Sumtill(n) % k == Sumtill(m) % k means Sum(n...m) is divisible by k. Got it Thanks to sir. 2) mod = num % k ; if (mod < 0) mod = k - mod // the edge case
wonderful explanation as always . Your method of first proving why the concept/technique works and then implementing it is awesome!! keep up the good work :)
Bro , your neat code, your clear voice explaination, and your pure intention to make us learn is just unmatchable! There are very few people at you tube jo itna shiddat se pdate he. Hatts off bro! Thank youuu🫂
You are awesome bhaiya I already solve the question using the map but your explanation comes like cherry 🍒 on top and by that my understanding towards the question increases to 10 times and for that really thankyou bhaiya really thankyou
Bro I am addicted to your channel Day by day.what a explanation brute force code explain then code submit then Explain TLE and again optimise approach.no one is teaching from that much depth
Hi Sir, Brute force will be of O(n^2) not O(n^3) as you said at 04:49 Code: class Solution { public int subarraysDivByK(int[] nums, int k) { int sum, count=0; for(int i=0; i
A slightly better approach o(n2) whithout using prefix array the idea is to calculate the sum while building the subarrays class Solution { public: int subarraysDivByK(vector& nums, int k) { int n = nums.size(); int ans = 0; for(int i = 0;i
Nice explanation sirji.....its a request plzz try to make videos little short....you would see a lot increase in no. of views on your channel.....btw thanks
mein pehele try kiya aur n^2 solution hi likh paya then saw ur video , awesome explanation sir!! My Approach int subarraysDivByK(vector& nums, int k) { //O(n^2) int ans = 0; for (int i=0 ; i
this was my O(n^2) approach without prefix sum. Keep uploading. Nowadays if I get stuck I wait for your video to drop. class Solution { public: int subarraysDivByK(vector &nums, int k) { int n = nums.size(); int ans = 0; int sum = 0; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { sum += nums[j]; if (sum % k == 0) ans++; } sum = 0; } return ans; } };
maine brute force try kia, usme kewal 70 testcase pass hua and then tle aya. Can you make a video about what are importance of constraints.. and how to decide that as per constraint which which O() or bigOmega will be accepted... becoz i thought that 10^8 cycle per second is allowed , and in question we had Constraint that n is within 3x10^4... so i thought 10^4 ka square means 10^8 tak toh chalna chahiye tha means O(n square) chalna chahiya tha but nahi chala ... plzzz ispe video banao na..explaining these complexities(sorry for typos)
Hey MIK Longest subarray with sum divisible by K can u please make a video on this topic in your free time .. it should be based on similar logic right ?
sir, i have a question , what if remainder is not present in the map???? i know we have to push it into the map right..... but in the code we have not even pushed it, then how it is working??????
Best video on youtube to understand the concept of this question..Thank you so much brother 💖
Thank you so much Varun ❤️❤️❤️
Bruv don't stop uploading you are gonna get that 1M in no time, the way you explained all the mathematical stuff was too good👍
Thanks a lot 😇❤️
++
kya video hai bhiya OP 🙂lot a way better than all bhiya's & didi's
here we are using the modulo property which is (a-b)%m = (a%m - b%m + m)%m
Aapke 1 million jald hoga 🤩
Tysm ❤️❤️❤️
Sach me yaar. This guy is on fire
You are the only one jo ye pahle batate ho ki socha kaise jata h.
Fir prove krte ho. Yhi reason hai ki apki videos baki youtube videos se better hoti h.
Or aapke concept dekhne k baad mere ko code dekhne ki need aaj tk nhi hui.
True, I rarely felt the need to see the code, once I saw his explanation
True
I don't care how many subscribers or views you have. But you always have the best way of explaining questions. this is absolute luxury to have all this for free.
No one explains like you bro
You are the best
Bhai maja aa gya ❤ itna acche sai toh kisi ne nai samjya abhi tak
Bhaya aisa content pure UA-cam m khi ni h, na hi aisi awaj ❤️
Bro your explanation is so good that I can’t even imagine how you could have been able do this
🙏🙏❤️❤️
best way of explaining I have ever seen . Thank you so much sir .🙏
So nice of you. Thank you so much for watching 😇🙏
Bruteforce approach - O(n3) passed 70/73 testcases
Bruteforce approach with O(1) sum testcase passed 69/73 testcases
Thanks Bhaiya , your approach always improves my logic building skills
Make daily videos bhaiya , it will help me to crack companies , my interview is scheduled and if I watch your video daily , i will definetly crack good companies , bcoz same I will going to explain in Interview starts from brute force to optimised. please keep uploading video daily !
Sure
All the very best
Insane my brother⚔️⚔️🥵
Probably the best channel for learning the concept rather than the code
Bhaiya confidence hai ki agar aapke saath daily LeetCode problems karte raha to kuch hi dino me pura pura khud se solve kar paunga
Thanks for being there on youtube sharing all your knowledge
I am so glad to hear that.
And indeed we all will grow together 💪
for anyone wondering about the school division concept : In modular arithmetic, the remainder is always a non-negative number less than the divisor. So (-4 % 7 would be = 3). you are thinking right.
but In C++ (idk about other languages), the modulus operation with a negative dividend retains the sign of the dividend. Therefore, when you compute -4 % 7, the result will be -4
corner case is just lit🔥
every time I am stuck in the ques, I know MIK is there for me❤🙌
Tysm Atifhu 💓
Hey Brother , I watch your videos daily and I just want to tell you that You are doing great work . Keep it up 🤗 .
Love From Gujarat ❣.
Thank you for the daily videos. 🙌
Thanks a lot Jaydip ❤️❤️❤️
Two amazing concepts :
1,2,3.....n.......m
1) Sumtill(n) % k == Sumtill(m) % k
means Sum(n...m) is divisible by k. Got it Thanks to sir.
2) mod = num % k ;
if (mod < 0) mod = k - mod // the edge case
Thank you so much bhaiya..best explanation for modulo concept 💥❤️
wonderful explanation as always . Your method of first proving why the concept/technique works and then implementing it is awesome!! keep up the good work :)
Tysm ❤️❤️❤️
After trying so hard to grasp the concept, I finally came across this video and now I am thankful
i appreciate the depth of explanation that you have given in this video🔥🔥
Bro , your neat code, your clear voice explaination, and your pure intention to make us learn is just unmatchable!
There are very few people at you tube jo itna shiddat se pdate he.
Hatts off bro!
Thank youuu🫂
Means a lot. Thank you so much 🙏🙏❤️❤️
And the PERFECTION is here
Kya mast samjhate ho bhai. love you bhai
Better than any video present on this problem on youtube
You are awesome bhaiya I already solve the question using the map but your explanation comes like cherry 🍒 on top and by that my understanding towards the question increases to 10 times and for that really thankyou bhaiya really thankyou
Took around 1.5 hours to understand but finally it got inside my head, Thanks mate. Ye sum agar placement ka puch jarur batunga.
Thank you 😊 ❤️
the way you explain how to tackle with negative remainder is just awesome bro respect++
what awesome yaar, how did he considered 7n-4 that is still not clear. Could you please explain from where this n is coming.
Amazing explanation.
Literally i have no words for this video....your explanation is awesome.... thankyou so much 💖
Awesome explanation, and you were right, only you explained the root reason behind everything in the approach, huge love from south india
So nice of you
Thank you 🙏😇❤️
The best explanation on UA-cam for this video
Bro I am addicted to your channel Day by day.what a explanation brute force code explain then code submit then Explain TLE and again optimise approach.no one is teaching from that much depth
Bro u can make more views if u show java code as well like just see striver video.its suggestion
Sure Pankaj.
I will try that too soon.
Thanks a lot for your kind words
Sure Pankaj.
I will try that too soon.
Thanks a lot for your kind words
Best explanation on youtube.. please keep uploading solution with awesome explanation like this:)
Thank you so much 😇❤️🙏
ur level of explanation 💥, tnku soo much bhai ❤
Thank you so much ❤️😇🙏
best explanation 🙌🙌
Splendid Explanation Bhaiya !! Thanks & keep uploading such videos !! All the best to you😊😊😊😊🔥🔥
Thanks a ton for the Cumulative sum approach.
Happy to help ❤️
A lot of effort was put into this video. Thank you for the explanation!
Hi Sir,
Brute force will be of O(n^2) not O(n^3) as you said at 04:49
Code:
class Solution {
public int subarraysDivByK(int[] nums, int k) {
int sum, count=0;
for(int i=0; i
thank you so much for this!!
great explanation!!! keep making these videos 👍👍
Tysm Jay ❤️❤️❤️
big respect for you brother, good explanation, quality video ! please continue your DSA series as well.
Good Explained 😊
Thanks a lot
3 approaches 🔥🔥🔥
A slightly better approach o(n2) whithout using prefix array
the idea is to calculate the sum while building the subarrays
class Solution {
public:
int subarraysDivByK(vector& nums, int k) {
int n = nums.size();
int ans = 0;
for(int i = 0;i
Yes, I also did the same
29:54 great job bro this is what we want
your channel is going to grow , best of luck , well explained
Thanks a lot Anmol ❤️
mind blowing brdr👌✅
Insane explanation just subscribed the channel
Thank you so much 😇🙏❤️
I tried this approach in my first attempt
void solve(vector& nums, int index, vector& temp) {
if(index == nums.size()) return;
vector ans;
for(int i=index; i
best video bro dayum
Amazing explanation of concepts step by step! Literally the best on UA-cam!! 1M zyada door nahi
Means a lot. Thank you so much 😇🙏
Next level explanation
wonderful explanation
Thank you 😇🙏
Very nice and detailed approach✨
Very helpful!
Thank you👍
very good explanation thank you bhaiya
Great Explanation sir!
It means a lot. Thank you 😇❤️
iska mtlb jahan bhi subarray ki bat ho aur k diya ho divisible jaisa kch modulo baba ki jai ho soch skte .Crrct me if i am wrong.
You explain so well!!! Thanks a lot.
always waiting for you video .best teacher in yt..😀😀😀
Thanks a lot Saurabh ❤️❤️❤️
best teacher ,
Thankyou sir understood 🙇♂🙏❤
So glad to hear ❤️❤️❤️
Please Provide a Video on KMP and Z-Algorithm . We will be thankful
KMP - ua-cam.com/video/qases-9gOpk/v-deo.htmlsi=WDpG81RfsXWdXUX1
Due to this negative remainder edge case i am unable to pass all testcases .
Nice explanation sirji.....its a request plzz try to make videos little short....you would see a lot increase in no. of views on your channel.....btw thanks
Bhai superb explaination!!!
thank you! big fan of your explanation
3 ways 🔥🔥🔥
mein pehele try kiya aur n^2 solution hi likh paya then saw ur video , awesome explanation sir!!
My Approach
int subarraysDivByK(vector& nums, int k) {
//O(n^2)
int ans = 0;
for (int i=0 ; i
Thanks a lot Pritish.
And I am so glad you tried O(n^2) on your own first. Way to go 💪💪💪
Great Work
this was my O(n^2) approach without prefix sum. Keep uploading. Nowadays if I get stuck I wait for your video to drop.
class Solution {
public:
int subarraysDivByK(vector &nums, int k) {
int n = nums.size();
int ans = 0;
int sum = 0;
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j++) {
sum += nums[j];
if (sum % k == 0) ans++;
}
sum = 0;
}
return ans;
}
};
Awesome
The O(n) approach is too hard to come up with.😅😅
@@codestorywithMIK bro why you used map in the github code instead of unordered_map?
That’s an old code. I will update it.
Thanks for reminding Shrijal
Let me update it now
@@codestorywithMIK 🙌🙌
goat explanation
moj karadi sir.
thank you boss
Hidden Gem .
bhaiya make videos on lc 401 and biweekly 132 (3rd and 4th one) dp
Great explanation!
This line 29:53 shows your Patience level bro.
Thanks a lot ❤️
true
Op Explanation sir
Thank you so much bhaiya ❤❤
Mast ❤
This is lit 👌🏻👌🏻👌🏻
mza aa gya bhai..thanks
maine brute force try kia, usme kewal 70 testcase pass hua and then tle aya. Can you make a video about what are importance of constraints.. and how to decide that as per constraint which which O() or bigOmega will be accepted... becoz i thought that 10^8 cycle per second is allowed , and in question we had Constraint that n is within 3x10^4... so i thought 10^4 ka square means 10^8 tak toh chalna chahiye tha means O(n square) chalna chahiya tha but nahi chala ... plzzz ispe video banao na..explaining these complexities(sorry for typos)
OP brother
Thanks a lot Saurabh ❤️❤️❤️
Bhaya ek vedio on all important algorithm for competitive 🙏🙏🙏 waiting for your vedio or a short ...
Sure. Soon Sourav
Thanks a lot!
Thank you for watching 😇🙏
well explained
if remainder is negative why we adding k rather than any number? modulo + k wala part hard hea
Hey MIK
Longest subarray with sum divisible by K
can u please make a video on this topic in your free time ..
it should be based on similar logic right ?
🔥
Thanks!
Most welcome 😇❤️
BHaiya please provide solution of leetcode contest 3181 solution please
Best.
sir, i have a question , what if remainder is not present in the map????
i know we have to push it into the map right.....
but in the code we have not even pushed it, then how it is working??????
at 18:26 5 divide by 7 5 kaise aa raha hai and same goes for 2 divide by 7 2 kaise aa raha hai
Good job man.
Thanks a lot