HackerRank - Between Two Sets | Full Solution with Examples and Visuals | Study Algorithms

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.พ. 2025

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

  • @jordixboy
    @jordixboy ปีที่แล้ว +4

    that intro, is so relatable. I know its a simple problem, but the way its written is omfg ...

  • @CostaKazistov
    @CostaKazistov 3 ปีที่แล้ว +21

    Nailed the explanation!
    I was so confused by the description.
    Many thanks for clarifying what this HackerRank problem was all about.

  • @sergiooliva2517
    @sergiooliva2517 2 ปีที่แล้ว +4

    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!

  • @dumbstonks
    @dumbstonks 4 หลายเดือนก่อน

    Underrated DSA channel. You deserve more brother! Don't stop uploading such tutorials.

  • @Ahnaf-jj6fr
    @Ahnaf-jj6fr 3 ปีที่แล้ว +3

    thank you so much. i quitted coding cuz i couldnt solve this problem . but thanks to you , im back again

  • @YashwithaKulal-i7l
    @YashwithaKulal-i7l 6 หลายเดือนก่อน +1

    Bro..! you are really good at explanation.. understood clearly ..Thankyou so much

  • @faizandarwesh7867
    @faizandarwesh7867 2 ปีที่แล้ว +4

    This is probably the best explanation of that problem statement. Great work.

    • @nikoo28
      @nikoo28  2 ปีที่แล้ว

      Glad I could help you out 😄

  • @AditiKumari-wt3gl
    @AditiKumari-wt3gl 3 ปีที่แล้ว +2

    the way you have approach the solution of this problem is really great

  • @gwapsgarcia
    @gwapsgarcia 3 ปีที่แล้ว +2

    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

  • @arjunmr9811
    @arjunmr9811 4 ปีที่แล้ว +3

    This man deserves more views. Keep going bro

  • @radhikagarg269
    @radhikagarg269 3 ปีที่แล้ว +1

    I have no words to express my feeling !! ... After watching ur video now i m having confidence again

  • @poonamchaurasia2484
    @poonamchaurasia2484 2 ปีที่แล้ว +1

    Really Great logic mind in simple way, Thanks a lot Nikhil 🙂

  • @nadimpatel4964
    @nadimpatel4964 ปีที่แล้ว

    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?!?!?!?

    • @nikoo28
      @nikoo28  ปีที่แล้ว +1

      that problem is written very weirdly...

  • @IndieTechHindi
    @IndieTechHindi 3 ปีที่แล้ว +1

    Bhai please keep making videos..... don't look at the audience size... because we the current subscribers love you so much.

  • @chunyinlai3517
    @chunyinlai3517 ปีที่แล้ว

    Very detail explain the question and the solution, Thanks for your efforts!

  • @johnstamos5948
    @johnstamos5948 2 ปีที่แล้ว

    Honestly the first 20 seconds helps a lot already

  • @unaisulhadi9102
    @unaisulhadi9102 2 ปีที่แล้ว +1

    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..! ❣

    • @nikoo2805
      @nikoo2805 2 ปีที่แล้ว +1

      Thank you so much

  • @superbalaji1988
    @superbalaji1988 3 ปีที่แล้ว +1

    The way you explain is really great bro I like it .. keep posting ...such more n more videos..,..

  • @VishalTrivediB
    @VishalTrivediB 4 ปีที่แล้ว +5

    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?

    • @nikoo28
      @nikoo28  4 ปีที่แล้ว +3

      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.

    • @VishalTrivediB
      @VishalTrivediB 4 ปีที่แล้ว +1

      @@nikoo28 I never even thought about that, thanks again!

  • @atrikashow8118
    @atrikashow8118 ปีที่แล้ว

    Great Sir
    Thanks a ton
    🤩🤩🤩🤩

  • @matheusfelizardo9155
    @matheusfelizardo9155 ปีที่แล้ว +1

    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

    • @nikoo28
      @nikoo28  ปีที่แล้ว

      Great 👍

  • @naveenarunkumar95
    @naveenarunkumar95 ปีที่แล้ว

    Thank u so much bro for your Better and best explanation

  • @namnayit
    @namnayit 4 ปีที่แล้ว +3

    Thank you so much!❤ You are the best!

  • @shortwish5669
    @shortwish5669 3 ปีที่แล้ว +1

    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...😍💝

  • @AnkitPandey-es7wk
    @AnkitPandey-es7wk 3 ปีที่แล้ว +2

    Thank you for such a great explanation 🙏🙏

  • @l.paulsonraja4036
    @l.paulsonraja4036 4 ปีที่แล้ว +1

    Simply Superb.! Thanks.

  • @surajmaity6194
    @surajmaity6194 3 ปีที่แล้ว +2

    Really awesome.
    Amazing explanation

  • @jdbs9514
    @jdbs9514 10 หลายเดือนก่อน

    great explanation bro!!

  • @MrAndrewLawrence420
    @MrAndrewLawrence420 3 ปีที่แล้ว +4

    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.

    • @nikoo28
      @nikoo28  3 ปีที่แล้ว +3

      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 :)

  • @bishalmohari8748
    @bishalmohari8748 3 ปีที่แล้ว +12

    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.

  • @mayursoni346
    @mayursoni346 2 ปีที่แล้ว

    this man deserves more likes and subscribers - keep it bro.

    • @nikoo28
      @nikoo28  2 ปีที่แล้ว

      😄😄😄

  • @lime_crow
    @lime_crow 2 ปีที่แล้ว

    Mantap AKMJ.
    Thank you sir, you're our hero.

  • @animatedvevo
    @animatedvevo 3 ปีที่แล้ว

    Bhai maza aagaya....🙌

  • @manishsinghparihar9006
    @manishsinghparihar9006 2 ปีที่แล้ว +1

    Thanks Man!!

  • @sohebkhan4230
    @sohebkhan4230 3 ปีที่แล้ว

    Maja aa gya sir genuinely bhut sahi smjaya..thanks 😊 a lots brother

    • @sohebkhan4230
      @sohebkhan4230 3 ปีที่แล้ว

      But code agr python m hota to or bhi sahi rehta Sir

  • @Abhijeetkumar-px1yc
    @Abhijeetkumar-px1yc 3 ปีที่แล้ว +1

    Thanks a lot to explain it, very nice explaination

  • @amorphous4768
    @amorphous4768 ปีที่แล้ว

    Love you sir 🙂 infinity

  • @dakeram7139
    @dakeram7139 ปีที่แล้ว

    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

    • @nikoo28
      @nikoo28  ปีที่แล้ว

      that problem is written very weirdly...

  • @exaltant2464
    @exaltant2464 3 ปีที่แล้ว +1

    Wow this is so great. 🙏

  • @veyselbasbaydar5665
    @veyselbasbaydar5665 2 ปีที่แล้ว

    great explanation

  • @kato5819
    @kato5819 4 ปีที่แล้ว +1

    thank you so much this video helped me a lot

    • @nikoo28
      @nikoo28  4 ปีที่แล้ว

      Glad it helped!

  • @mdnawab3634
    @mdnawab3634 2 ปีที่แล้ว

    His Intro was lit 🔥

  • @rekhajudhagiri3406
    @rekhajudhagiri3406 2 ปีที่แล้ว

    Amazing explanation brother 👌

    • @nikoo28
      @nikoo28  2 ปีที่แล้ว

      Thank you 🙂

  • @dhruvbisht7755
    @dhruvbisht7755 3 ปีที่แล้ว

    Really great explanation sir

  • @tasnimsart3430
    @tasnimsart3430 3 ปีที่แล้ว

    Thanks so much, God bless you

  • @julianricardo8893
    @julianricardo8893 ปีที่แล้ว

    My English is not good, but I understood you. Thanks

  • @briana4289
    @briana4289 2 ปีที่แล้ว

    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
      @sunoo_v3891 2 ปีที่แล้ว

      can you share your code

    • @priyaramesh7196
      @priyaramesh7196 2 ปีที่แล้ว

      @@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)

  • @sanjeebkumargouda1471
    @sanjeebkumargouda1471 3 ปีที่แล้ว

    Great Explanation

  • @08.billyfirdaushanafi70
    @08.billyfirdaushanafi70 4 ปีที่แล้ว +1

    thank u so much

  • @bazeenn
    @bazeenn 3 ปีที่แล้ว

    This is awesome. Thanks.

  • @siddhantbankar
    @siddhantbankar 2 ปีที่แล้ว

    thank you very much man it means lot to me🙌❤

    • @nikoo28
      @nikoo28  2 ปีที่แล้ว

      It's my pleasure

  • @kushalkush7118
    @kushalkush7118 3 ปีที่แล้ว

    thank you I wish you grow well(i belive you do) keep going.

  • @AB-mm9id
    @AB-mm9id 3 ปีที่แล้ว

    Thank you!

  • @lalithsai7210
    @lalithsai7210 ปีที่แล้ว

    Thanks

  • @shubhampatrick9495
    @shubhampatrick9495 3 ปีที่แล้ว

    Amazing explanation bro

  • @AbhishekSingh-dt6br
    @AbhishekSingh-dt6br 3 ปีที่แล้ว

    great explanation!!!!

  • @fikrihaikal1353
    @fikrihaikal1353 2 ปีที่แล้ว

    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?

  • @ManishThakur-lm7gh
    @ManishThakur-lm7gh 2 ปีที่แล้ว

    thanks

  • @kamalkumar945
    @kamalkumar945 3 ปีที่แล้ว

    underrated content

  • @carloseduardosanchezcarras4151
    @carloseduardosanchezcarras4151 7 หลายเดือนก่อน

    brother no hablo ingles pero entendi perfectamente gracias

  • @kingsman.blood1
    @kingsman.blood1 3 ปีที่แล้ว

    nice explainnation

  • @s.akhtarjoomun263
    @s.akhtarjoomun263 3 ปีที่แล้ว

    function getTotalX(a, b) {
    let count = 0;
    let min = Math.max(...a);
    let max = Math.min(...b);
    for (let k = min; k

  • @andhernand
    @andhernand 9 หลายเดือนก่อน

    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.

    • @nikoo28
      @nikoo28  9 หลายเดือนก่อน

      I totally agree. Very poorly written

  • @kancharlakeerthi1819
    @kancharlakeerthi1819 ปีที่แล้ว

    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

  • @obedasante2168
    @obedasante2168 3 ปีที่แล้ว

    I understood the question very well before coming here....but implementation was the problem....but I still feel this implementation is way complex

  • @everyontech2716
    @everyontech2716 ปีที่แล้ว +1

    Which app you used to write content in iPad with pencil ?

    • @nikoo28
      @nikoo28  ปีที่แล้ว +1

      That is GoodNotes 5

    • @everyontech2716
      @everyontech2716 ปีที่แล้ว

      @@nikoo28 Thank you so much

  • @agentphoenixtm642
    @agentphoenixtm642 3 ปีที่แล้ว

    First i Got Shocked To See Way He Simplified The Problem Then I Got More Shocked After Seeing His No Of Subscribers

  • @Cromfeld
    @Cromfeld 3 ปีที่แล้ว

    I am happy, because I am not the only who is confused. Btw the hackerrank trivias are written in a bad way.

  • @yashraval8844
    @yashraval8844 4 ปีที่แล้ว +1

    +respect bro

  • @radhikagarg269
    @radhikagarg269 3 ปีที่แล้ว

    Plz make a video in C code also.

  • @vinaybansode7097
    @vinaybansode7097 9 หลายเดือนก่อน

    Sir, Can you explain getGCD() and getLCM() function

    • @nikoo28
      @nikoo28  9 หลายเดือนก่อน

      Greatest common divisor, and lowest common multiple.
      Pretty standard mathematical terms :)

  • @charann18
    @charann18 2 ปีที่แล้ว

    That logiccc

  • @asrithajavvaji0847
    @asrithajavvaji0847 3 ปีที่แล้ว

    This man deserves more likes,views and subscribers..👏👏

  • @shalabhbhatiya5659
    @shalabhbhatiya5659 4 ปีที่แล้ว

    can you plz explain me why you choose first element of list to find gcd and LCM

    • @nikoo28
      @nikoo28  4 ปีที่แล้ว

      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.

    • @shalabhbhatiya5659
      @shalabhbhatiya5659 4 ปีที่แล้ว

      @@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

    • @nikoo28
      @nikoo28  4 ปีที่แล้ว

      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

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

    In ur code link there is no main method of Java it is giving error 😮

  • @Satenc0
    @Satenc0 2 ปีที่แล้ว

    I cant figure out how to calculate LCM (lowest common multiple) for any size array

  • @joaopaulorodriguespereira4768
    @joaopaulorodriguespereira4768 3 ปีที่แล้ว

    Could someone explain to me better about getLCM function, I don't get it very well.
    Everything else was very well explained. Thanks

    • @nikoo28
      @nikoo28  3 ปีที่แล้ว

      look at the complete source code on github (link in description)

  • @pratikhanwate
    @pratikhanwate ปีที่แล้ว

    explanation was good... but LCM of 4,8,12,16 is 16 not 4. GCD of 2,4,8,16 is 2 not 16

  • @chandanravi9153
    @chandanravi9153 2 ปีที่แล้ว +1

    getting compile error, can't find symbol getLCM

    • @nikoo28
      @nikoo28  2 ปีที่แล้ว

      check out the link in description for full code on github.

  • @kaus05
    @kaus05 3 วันที่ผ่านมา

    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]

  • @udaymishra5916
    @udaymishra5916 3 ปีที่แล้ว

    best

  • @glenescobar6776
    @glenescobar6776 10 หลายเดือนก่อน

    and the same thing ehit javascript????

  • @ayushimathur27
    @ayushimathur27 3 ปีที่แล้ว +1

    Ok bye !!😂😂you teach like I have taken some google course.

  • @arpitsirohi8095
    @arpitsirohi8095 3 ปีที่แล้ว

    noice

  • @shreeyabhosale1456
    @shreeyabhosale1456 3 ปีที่แล้ว

    I think your presentation skill is very good. but you have to explain the code properly. You did not explain how you calculate gcd

    • @nikoo28
      @nikoo28  3 ปีที่แล้ว +1

      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

  • @OxOv3rH4uL
    @OxOv3rH4uL 3 ปีที่แล้ว

    For the test case 2 , 32 also comes right? 32 is common in all

    • @nikoo28
      @nikoo28  2 ปีที่แล้ว

      32 is not a divisor of 16…so 32 will not be there

  • @vikivarun6122
    @vikivarun6122 3 ปีที่แล้ว

    ok bye @0.25 🤣🤣🤣🤣🤣

  • @anujkumarpatel2686
    @anujkumarpatel2686 3 ปีที่แล้ว +1

    don't you dare to stop doing this

    • @nikoo28
      @nikoo28  3 ปีที่แล้ว

      Thanks.. you can help me by sharing the video as much as you can.

  • @NeoLoveCookie
    @NeoLoveCookie 2 ปีที่แล้ว

    Still hard to me... am I idiot? 🥺

    • @nikoo28
      @nikoo28  2 ปีที่แล้ว

      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?

  • @wahyuiqsamsyafaq2939
    @wahyuiqsamsyafaq2939 3 ปีที่แล้ว

    i hate it when it is labeled "easy"

    • @nikoo28
      @nikoo28  3 ปีที่แล้ว

      Even I was super confused with the problem statement…I hope my video simplified it :)

  • @arslanmuhammad4190
    @arslanmuhammad4190 ปีที่แล้ว

    Ok Bye wow hahahahahaha

  • @typescripter
    @typescripter 4 ปีที่แล้ว +35

    This man deserves more views. Keep going bro

  • @pratikhanwate
    @pratikhanwate ปีที่แล้ว

    explanation was good... but LCM of 4,8,12,16 is 16 not 4. GCD of 2,4,8,16 is 2 not 16