Kth Missing Positive Number | Leet code 1539 | Theory explained + Python code

Sdílet
Vložit
  • čas přidán 26. 07. 2024
  • This video is a solution to Leet code 1539, Kth Missing Positive Number. I explain the question, go over how the logic / theory behind solving the question and finally solve it using Python code.
    Comment below if you have a better solution to this problem!
    Let me know if you have any feedback and don't forget to subscribe for more videos!
    Time stamps:
    0:00 Question Explained
    3:21 Solution Explained
    17:55 Python Code
    Code:
    leetcode.com/explore/challeng...)
    More leetcode questions solved:
    • Add and Search Word - ...

Komentáře • 23

  • @janmichaelaustria620
    @janmichaelaustria620 Před 3 lety +3

    omg best explanation ever! i was getting so tripped with the discussion boards on LC, but this was crystal clear! thank you so much!

    • @saianishmalla2646
      @saianishmalla2646  Před 3 lety +1

      Glad it helped !!! and yea same took me quite a while to understand each step.

  • @biranchinarayanpadhi9067
    @biranchinarayanpadhi9067 Před 3 lety +1

    Best Explanation for this Problem in You tube. Thank You and keep doing this quality of work which is helping a lot of people out there!

  • @afridimajeed5897
    @afridimajeed5897 Před 3 lety +2

    Thank you! This finally makes sense to me. You have an amazing style of teaching, please keep going!

  • @xinranwan9390
    @xinranwan9390 Před rokem

    thank you so much! I've checked out other youtube videos on this topic, and none is as clear as yours.

  • @ujeshnada7281
    @ujeshnada7281 Před 3 lety +2

    At 16:00 why did you subtract k & add 1 ??? Basically we got 6 missing number and we want 5th number.. So, cant we just subtract 1 ?
    Can you explain that part?

    • @michaelharris1305
      @michaelharris1305 Před rokem

      we subtract k and add 1 because , the value x shows how many missing no are there before it so we are actually standing just one number extra after all those missing numbers!!!
      so to count no of steps we will just subtract the k and add extra 1

  • @subhayanbairagi510
    @subhayanbairagi510 Před 3 lety +1

    lol, I had a bad habit to pause the video at middle and do it by myself, and there you did the +k mistake, I was confused, logic was right , but why it is not working, Then I start the video again, and I should finish the video First.........It was a really clear explanation , really smooth, thanks

  • @lilylily8494
    @lilylily8494 Před 2 lety

    Thank you!! Best explanation ever!

  • @nagendrabommireddi8437

    very very thank you anna

  • @satyamgupta6030
    @satyamgupta6030 Před rokem

    what a nice explaination brother . ur video is the best for this question thanks alot for such detailed explaination.

  • @drashtibhardwaj50
    @drashtibhardwaj50 Před 2 lety

    Crystal clear explanation ❤️

  • @ishayadav001
    @ishayadav001 Před 3 lety

    👏🏽👏🏽

  • @juliahuanlingtong6757
    @juliahuanlingtong6757 Před 3 lety

    Clear explanation!
    just 1 question, why is the break condition set while(left

    • @yashverma1188
      @yashverma1188 Před 2 lety

      Because we need to check every possible value that may end up our answer. Thats what binary search does.

  • @tirthteraiya
    @tirthteraiya Před 9 měsíci

    what is the intro song brother

  • @MIDNightPT4
    @MIDNightPT4 Před 2 lety

    Great explanation!

  • @abantikatonny
    @abantikatonny Před 2 lety

    time complexity?

  • @sankalp702
    @sankalp702 Před 3 lety

    what if we made another array with the missing numbers and then simply returned the element at (k-1) index?

    • @vighneshchavan9226
      @vighneshchavan9226 Před 2 lety

      That would also work, but it would make space complexity as O(n)