Kth Missing Positive Number | Leet code 1539 | Theory explained + Python code
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 - ...
omg best explanation ever! i was getting so tripped with the discussion boards on LC, but this was crystal clear! thank you so much!
Glad it helped !!! and yea same took me quite a while to understand each step.
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!
Glad the video helped!! thank you!
Thank you! This finally makes sense to me. You have an amazing style of teaching, please keep going!
Thank you!!
thank you so much! I've checked out other youtube videos on this topic, and none is as clear as yours.
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?
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
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
haha thank you glad it helped!
Thank you!! Best explanation ever!
very very thank you anna
what a nice explaination brother . ur video is the best for this question thanks alot for such detailed explaination.
Crystal clear explanation ❤️
👏🏽👏🏽
Clear explanation!
just 1 question, why is the break condition set while(left
Because we need to check every possible value that may end up our answer. Thats what binary search does.
what is the intro song brother
Great explanation!
time complexity?
what if we made another array with the missing numbers and then simply returned the element at (k-1) index?
That would also work, but it would make space complexity as O(n)