lol you resumed the problem in 1 sentence, I didn't get this until I heard you saying "multiples of the 1st array and factors of the 2nd array". So simple, thank you!
it is so frustrating for me to read and to understand the problem and the given example. i just want to spend an hour a day to practice but ended up taking more time until started searching for explanations. thanks for this
Im so glad I came across this. I thought I was the only one who felt this when reading and trying to understand the problem. "....for the given integer." Like which Integer?!?!?!?
Thank you very much for explaining this so clearly. I have a question though: If 16, 32 and 96 are considered factors in Test case #2 (4:00), why are 24 and 36 not considered factors in Test case #1?
you can write down 24 and 36 in the first test case as well, but they won't be common and not a part of the answer. So, I left them out. Let me know if this explains your concern :) If you goto 6:15, I have written them out.
Nice solution!! I used javascript to solve it. I did a loop through all numbers in all arrays to create a dataset with all multiplies and all factors and then I did a reduce to check if the number was in all arrays. Poor machine with my solution :/ but the tests passed haha
Excellent bro.. Really... What you say at 4:08 to 4:15 If you understand the problem statment you can do it on your own or else see the solution... That means you are not make video for the views.. Really great and great explanation...😍💝
You're supposed to be explaining to beginners how to solve an easy problem. But you did NOT do that. You only broke the problem down and explained it. You are very thorough and have the chance to have a great channel. But there's not a single beginner that can actually solve this problem based on this video.
Thanks for the feedback Andrew, but the video is not intended for beginners. It is just categorized under Easy on HackerRank. Also the video is more oriented towards audience who have at least tried the problem once on their own. If you are looking to learn, there are other theoretical videos on the channel, which can help you learn as a beginner :)
I have been bashing my head with this problem for hours. But man you kind of enlightened me with this explanation. Just an amazing way to go about it, keep growing man.
I am a Spanish speaker, I thought the difficulty came from not knowing English very well, or that I was just dumb. I'm glad I'm not the only one who didn't understand :D
My approach was to find the shared factors inclusive of the max number in array 'a' and the min number in array 'b'. These shared factors are the only ones that can possibly work, so it reduces the number of comparisons to check. Then, I find which of those factors are not a factor of some number in array 'b', and reduce the set of factors even more. Then I check the factors against the numbers in 'a' to see if any are not divisible, and throw any of those out. The remaining number of factors is the answer. Perhaps not the most elegant, but not brute force either.
@@sunoo_v3891 def getTotalX(a, b): # Write your code here
num=[] for i in range(max(a),min(b)+1): flag=0 tag=0 for k in range(len(a)): if (i%a[k]!=0): tag=1 if tag==0: for j in range(len(b)): if(b[j]%i!=0): flag=1 if flag==0: num.append(i) return len(num)
Thanks for that problem explanation. The original problem explanation has to be one of the worst written explanations ever. After your explanation I was able to solve the problem on my own. I did not need to watch past the 4:16 mark.
We don't choose the first element. We are taking all the elements, for example at 8:38, we take multiple of both 2 and 4. Similarly, for GCD, we take all the elements.
@@nikoo28 sir in video 10:44 gcd is the highest number so according to me gcd is 2 because 2 is the common highest number that divide all the element in array number 2
As the name suggests, greatest common divisor, 2 is the lowest common divisor. We are finding all the multiples of GCD. 16 is the greatest divisor. 16 is the greatest number that divides all elements of array number 2
Hi Shreeya, it gets a little hard to explain each and every concept in a solution video. Calculating GCD is a basic mathematical concept. However, to make things easier check the video description. You can find a text based explanation and also the link to full code on Github. That should help you. :) wish you the best
Never think like that… :) The problem itself has been written in a very confusing way. You skip this one to be honest. Else let me know where are you having a problem? Did you see the link in description to my github profile for full code yet?
that intro, is so relatable. I know its a simple problem, but the way its written is omfg ...
Nailed the explanation!
I was so confused by the description.
Many thanks for clarifying what this HackerRank problem was all about.
lol you resumed the problem in 1 sentence, I didn't get this until I heard you saying "multiples of the 1st array and factors of the 2nd array". So simple, thank you!
Underrated DSA channel. You deserve more brother! Don't stop uploading such tutorials.
thank you so much. i quitted coding cuz i couldnt solve this problem . but thanks to you , im back again
Bro..! you are really good at explanation.. understood clearly ..Thankyou so much
This is probably the best explanation of that problem statement. Great work.
Glad I could help you out 😄
the way you have approach the solution of this problem is really great
it is so frustrating for me to read and to understand the problem and the given example. i just want to spend an hour a day to practice but ended up taking more time until started searching for explanations. thanks for this
This man deserves more views. Keep going bro
I have no words to express my feeling !! ... After watching ur video now i m having confidence again
Really Great logic mind in simple way, Thanks a lot Nikhil 🙂
Im so glad I came across this. I thought I was the only one who felt this when reading and trying to understand the problem. "....for the given integer." Like which Integer?!?!?!?
that problem is written very weirdly...
Bhai please keep making videos..... don't look at the audience size... because we the current subscribers love you so much.
Very detail explain the question and the solution, Thanks for your efforts!
Honestly the first 20 seconds helps a lot already
Wow, Amazing.. I've been looking at the problem description for for a long time. Glad I found this video, You earned a sub.
Keep going..! ❣
Thank you so much
The way you explain is really great bro I like it .. keep posting ...such more n more videos..,..
Thank you very much for explaining this so clearly. I have a question though: If 16, 32 and 96 are considered factors in Test case #2 (4:00), why are 24 and 36 not considered factors in Test case #1?
you can write down 24 and 36 in the first test case as well, but they won't be common and not a part of the answer. So, I left them out. Let me know if this explains your concern :)
If you goto 6:15, I have written them out.
@@nikoo28 I never even thought about that, thanks again!
Great Sir
Thanks a ton
🤩🤩🤩🤩
Nice solution!! I used javascript to solve it.
I did a loop through all numbers in all arrays to create a dataset with all multiplies and all factors and then I did a reduce to check if the number was in all arrays.
Poor machine with my solution :/ but the tests passed haha
Great 👍
Thank u so much bro for your Better and best explanation
Thank you so much!❤ You are the best!
Excellent bro.. Really... What you say at 4:08 to 4:15
If you understand the problem statment you can do it on your own or else see the solution...
That means you are not make video for the views..
Really great and great explanation...😍💝
Thank you for such a great explanation 🙏🙏
Simply Superb.! Thanks.
Really awesome.
Amazing explanation
great explanation bro!!
You're supposed to be explaining to beginners how to solve an easy problem. But you did NOT do that. You only broke the problem down and explained it. You are very thorough and have the chance to have a great channel. But there's not a single beginner that can actually solve this problem based on this video.
Thanks for the feedback Andrew, but the video is not intended for beginners. It is just categorized under Easy on HackerRank. Also the video is more oriented towards audience who have at least tried the problem once on their own. If you are looking to learn, there are other theoretical videos on the channel, which can help you learn as a beginner :)
I have been bashing my head with this problem for hours. But man you kind of enlightened me with this explanation. Just an amazing way to go about it, keep growing man.
I have been bashing my head from days
this man deserves more likes and subscribers - keep it bro.
😄😄😄
Mantap AKMJ.
Thank you sir, you're our hero.
Bhai maza aagaya....🙌
Thanks Man!!
Maja aa gya sir genuinely bhut sahi smjaya..thanks 😊 a lots brother
But code agr python m hota to or bhi sahi rehta Sir
Thanks a lot to explain it, very nice explaination
Love you sir 🙂 infinity
I am a Spanish speaker, I thought the difficulty came from not knowing English very well, or that I was just dumb. I'm glad I'm not the only one who didn't understand :D
that problem is written very weirdly...
Wow this is so great. 🙏
great explanation
thank you so much this video helped me a lot
Glad it helped!
His Intro was lit 🔥
Amazing explanation brother 👌
Thank you 🙂
Really great explanation sir
Thanks so much, God bless you
My English is not good, but I understood you. Thanks
My approach was to find the shared factors inclusive of the max number in array 'a' and the min number in array 'b'. These shared factors are the only ones that can possibly work, so it reduces the number of comparisons to check. Then, I find which of those factors are not a factor of some number in array 'b', and reduce the set of factors even more. Then I check the factors against the numbers in 'a' to see if any are not divisible, and throw any of those out. The remaining number of factors is the answer. Perhaps not the most elegant, but not brute force either.
can you share your code
@@sunoo_v3891 def getTotalX(a, b):
# Write your code here
num=[]
for i in range(max(a),min(b)+1):
flag=0
tag=0
for k in range(len(a)):
if (i%a[k]!=0):
tag=1
if tag==0:
for j in range(len(b)):
if(b[j]%i!=0):
flag=1
if flag==0:
num.append(i)
return len(num)
Great Explanation
thank u so much
This is awesome. Thanks.
thank you very much man it means lot to me🙌❤
It's my pleasure
thank you I wish you grow well(i belive you do) keep going.
Thank you!
Thanks
Amazing explanation bro
great explanation!!!!
So, I get this point. If the modulo from GCD to a LCM is 0. Then that LCM is part of the GCD. Is it correct?
thanks
underrated content
brother no hablo ingles pero entendi perfectamente gracias
nice explainnation
function getTotalX(a, b) {
let count = 0;
let min = Math.max(...a);
let max = Math.min(...b);
for (let k = min; k
Thanks for that problem explanation. The original problem explanation has to be one of the worst written explanations ever. After your explanation I was able to solve the problem on my own. I did not need to watch past the 4:16 mark.
I totally agree. Very poorly written
Bhai,when comes to factors of 24 from 1 to 24 we can find but when comes to multiples what is the limit for multiples
I understood the question very well before coming here....but implementation was the problem....but I still feel this implementation is way complex
Which app you used to write content in iPad with pencil ?
That is GoodNotes 5
@@nikoo28 Thank you so much
First i Got Shocked To See Way He Simplified The Problem Then I Got More Shocked After Seeing His No Of Subscribers
I am happy, because I am not the only who is confused. Btw the hackerrank trivias are written in a bad way.
+respect bro
Plz make a video in C code also.
Sir, Can you explain getGCD() and getLCM() function
Greatest common divisor, and lowest common multiple.
Pretty standard mathematical terms :)
That logiccc
This man deserves more likes,views and subscribers..👏👏
can you plz explain me why you choose first element of list to find gcd and LCM
We don't choose the first element. We are taking all the elements, for example at 8:38, we take multiple of both 2 and 4. Similarly, for GCD, we take all the elements.
@@nikoo28 sir in video 10:44 gcd is the highest number so according to me gcd is 2 because 2 is the common highest number that divide all the element in array number 2
As the name suggests, greatest common divisor, 2 is the lowest common divisor.
We are finding all the multiples of GCD.
16 is the greatest divisor. 16 is the greatest number that divides all elements of array number 2
In ur code link there is no main method of Java it is giving error 😮
I cant figure out how to calculate LCM (lowest common multiple) for any size array
Could someone explain to me better about getLCM function, I don't get it very well.
Everything else was very well explained. Thanks
look at the complete source code on github (link in description)
explanation was good... but LCM of 4,8,12,16 is 16 not 4. GCD of 2,4,8,16 is 2 not 16
getting compile error, can't find symbol getLCM
check out the link in description for full code on github.
for the second test case i thought the below were the input and was so confused as to how this is working, i am so dumb
a = [2,3]
b = [2,4]
best
and the same thing ehit javascript????
Ok bye !!😂😂you teach like I have taken some google course.
noice
I think your presentation skill is very good. but you have to explain the code properly. You did not explain how you calculate gcd
Hi Shreeya, it gets a little hard to explain each and every concept in a solution video.
Calculating GCD is a basic mathematical concept.
However, to make things easier check the video description. You can find a text based explanation and also the link to full code on Github.
That should help you. :) wish you the best
For the test case 2 , 32 also comes right? 32 is common in all
32 is not a divisor of 16…so 32 will not be there
ok bye @0.25 🤣🤣🤣🤣🤣
don't you dare to stop doing this
Thanks.. you can help me by sharing the video as much as you can.
Still hard to me... am I idiot? 🥺
Never think like that… :)
The problem itself has been written in a very confusing way. You skip this one to be honest.
Else let me know where are you having a problem?
Did you see the link in description to my github profile for full code yet?
i hate it when it is labeled "easy"
Even I was super confused with the problem statement…I hope my video simplified it :)
Ok Bye wow hahahahahaha
This man deserves more views. Keep going bro
ok disliked the video
agree
@@ravikantamal7163 bhai tujhe nhi smjha toh jali kya...
explanation was good... but LCM of 4,8,12,16 is 16 not 4. GCD of 2,4,8,16 is 2 not 16