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

Поділитися
Вставка
  • Опубліковано 16 гру 2024

КОМЕНТАРІ • 127

  • @jordixboy
    @jordixboy Рік тому +4

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

  • @sergiooliva2517
    @sergiooliva2517 Рік тому +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!

  • @CostaKazistov
    @CostaKazistov 2 роки тому +21

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

  • @Ahnaf-jj6fr
    @Ahnaf-jj6fr 2 роки тому +3

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

  • @dumbstonks
    @dumbstonks 2 місяці тому

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

  • @YashwithaKulal-i7l
    @YashwithaKulal-i7l 4 місяці тому +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

  • @radhikagarg269
    @radhikagarg269 3 роки тому +1

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

  • @arjunmr9811
    @arjunmr9811 3 роки тому +3

    This man deserves more views. Keep going bro

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

  • @johnstamos5948
    @johnstamos5948 2 роки тому

    Honestly the first 20 seconds helps a lot already

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

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

  • @poonamchaurasia2484
    @poonamchaurasia2484 2 роки тому +1

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

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

  • @VishalTrivediB
    @VishalTrivediB 3 роки тому +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  3 роки тому +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 3 роки тому +1

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

  • @chunyinlai3517
    @chunyinlai3517 Рік тому

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

  • @superbalaji1988
    @superbalaji1988 2 роки тому +1

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

  • @naveenarunkumar95
    @naveenarunkumar95 Рік тому

    Thank u so much bro for your Better and best explanation

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

  • @lime_crow
    @lime_crow 2 роки тому

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

  • @AnkitPandey-es7wk
    @AnkitPandey-es7wk 3 роки тому +2

    Thank you for such a great explanation 🙏🙏

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

  • @mayursoni346
    @mayursoni346 2 роки тому

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

  • @atrikashow8118
    @atrikashow8118 Рік тому

    Great Sir
    Thanks a ton
    🤩🤩🤩🤩

  • @surajmaity6194
    @surajmaity6194 3 роки тому +2

    Really awesome.
    Amazing explanation

  • @l.paulsonraja4036
    @l.paulsonraja4036 3 роки тому +1

    Simply Superb.! Thanks.

  • @namnayit
    @namnayit 3 роки тому +3

    Thank you so much!❤ You are the best!

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

  • @jdbs9514
    @jdbs9514 8 місяців тому

    great explanation bro!!

  • @mdnawab3634
    @mdnawab3634 2 роки тому

    His Intro was lit 🔥

  • @Abhijeetkumar-px1yc
    @Abhijeetkumar-px1yc 3 роки тому +1

    Thanks a lot to explain it, very nice explaination

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

  • @julianricardo8893
    @julianricardo8893 Рік тому

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

  • @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. 🙏

  • @animatedvevo
    @animatedvevo 2 роки тому

    Bhai maza aagaya....🙌

  • @dhruvbisht7755
    @dhruvbisht7755 3 роки тому

    Really great explanation sir

  • @tasnimsart3430
    @tasnimsart3430 3 роки тому

    Thanks so much, God bless you

  • @kato5819
    @kato5819 3 роки тому +1

    thank you so much this video helped me a lot

    • @nikoo28
      @nikoo28  3 роки тому

      Glad it helped!

  • @manishsinghparihar9006
    @manishsinghparihar9006 2 роки тому +1

    Thanks Man!!

  • @amorphous4768
    @amorphous4768 11 місяців тому

    Love you sir 🙂 infinity

  • @rekhajudhagiri3406
    @rekhajudhagiri3406 Рік тому

    Amazing explanation brother 👌

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

  • @kushalkush7118
    @kushalkush7118 3 роки тому

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

  • @sanjeebkumargouda1471
    @sanjeebkumargouda1471 3 роки тому

    Great Explanation

  • @asrithajavvaji0847
    @asrithajavvaji0847 3 роки тому

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

  • @veyselbasbaydar5665
    @veyselbasbaydar5665 2 роки тому

    great explanation

  • @shubhampatrick9495
    @shubhampatrick9495 3 роки тому

    Amazing explanation bro

  • @everyontech2716
    @everyontech2716 Рік тому +1

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

  • @kamalkumar945
    @kamalkumar945 3 роки тому

    underrated content

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

  • @siddhantbankar
    @siddhantbankar Рік тому

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

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

  • @m2tdev
    @m2tdev 3 роки тому

    This is awesome. Thanks.

  • @AbhishekSingh-dt6br
    @AbhishekSingh-dt6br 3 роки тому

    great explanation!!!!

  • @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 2 роки тому

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

  • @08.billyfirdaushanafi70
    @08.billyfirdaushanafi70 3 роки тому +1

    thank u so much

  • @AB-mm9id
    @AB-mm9id 3 роки тому

    Thank you!

  • @carloseduardosanchezcarras4151
    @carloseduardosanchezcarras4151 6 місяців тому

    brother no hablo ingles pero entendi perfectamente gracias

  • @Satenc0
    @Satenc0 2 роки тому

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

  • @champion5946
    @champion5946 3 роки тому

    nice explainnation

  • @Cromfeld
    @Cromfeld 2 роки тому

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

  • @radhikagarg269
    @radhikagarg269 3 роки тому

    Plz make a video in C code also.

  • @yashraval8844
    @yashraval8844 3 роки тому +1

    +respect bro

  • @vinaybansode7097
    @vinaybansode7097 7 місяців тому

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

    • @nikoo28
      @nikoo28  7 місяців тому

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

  • @shalabhbhatiya5659
    @shalabhbhatiya5659 3 роки тому

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

    • @nikoo28
      @nikoo28  3 роки тому

      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 3 роки тому

      @@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  3 роки тому

      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

  • @andhernand
    @andhernand 7 місяців тому

    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  7 місяців тому

      I totally agree. Very poorly written

  • @charann18
    @charann18 2 роки тому

    That logiccc

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

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

  • @ManishThakur-lm7gh
    @ManishThakur-lm7gh Рік тому

    thanks

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

  • @vikivarun6122
    @vikivarun6122 3 роки тому

    ok bye @0.25 🤣🤣🤣🤣🤣

  • @udaymishra5916
    @udaymishra5916 3 роки тому

    best

  • @ayushimathur27
    @ayushimathur27 2 роки тому +1

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

  • @lalithsai7210
    @lalithsai7210 Рік тому

    Thanks

  • @glenescobar6776
    @glenescobar6776 8 місяців тому

    and the same thing ehit javascript????

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

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

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

  • @arpitsirohi8095
    @arpitsirohi8095 3 роки тому

    noice

  • @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 3 роки тому +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