Kth Missing Positive Number (LeetCode 1539) | Full Solution with intuition, animations and visuals

  Рет қаралды 2,231

Nikhil Lohia

Nikhil Lohia

Күн бұрын

Join this channel to get access to perks: / @nikoo28
Actual Problem: leetcode.com/problems/kth-mis...
Chapters:
00:00 - Intro
00:44 - Problem Statement
03:47 - Thought process
09:02 - One more test case
12:26 - Using Binary Search
13:52 - Dry-run of Code
15:04 - A special case
17:13 - Final Thoughts
📚 Links to topics I talk about in the video:
Array Data Structure: • Array Data Structure e...
Binary Search: • Binary Search Algorith...
Divide and Conquer: • Divide and Conquer alg...
What is Big O?: • Big O Notation Simplif...
Time Complexity of an algorithm: • What is the Time Compl...
Other Problems on Arrays: • Arrays
📘 A text based explanation is available at: studyalgorithms.com
Code on Github: github.com/nikoo28/java-solut...
Test-cases on Github: hgithub.com/nikoo28/java-solut...
📖 Reference Books:
Starting Learn to Code: amzn.to/3sJm8Wl
Favorite book to understand algorithms: amzn.to/4848xJH
Favorite book for data structures: amzn.to/3P96YBv
Get started for interview preparation: amzn.to/44Nn5du
🔗 To see more videos like this, you can show your support on: www.buymeacoffee.com/studyalg...
🎥 My Recording Gear:
Recording Light: amzn.to/3PdsViT
Microphone: amzn.to/3Exv83x
Recording Camera: amzn.to/3PwyN8e
Tablet to sketch and draw: amzn.to/3ZdKVy7
Sketching Tool: amzn.to/45XJEgY
Laptop to edit videos: amzn.to/460ofDu
💻 Get Social 💻
Follow on Facebook at: / studyalgos
Subscribe to RSS feeds: studyalgorithms.com/feed/
Join fan mail: eepurl.com/g9Dadv
#leetcode #programming #interview

Пікірлер: 16
@Iam_Srikanth_009
@Iam_Srikanth_009 3 ай бұрын
Really this guy needs a lot of support.... Thank you for explaining this problem and making me to understand it 😊. Really hats off for your explanation
@nikoo28
@nikoo28 3 ай бұрын
Thanks for all the support and motivation
@DharaniChavala
@DharaniChavala 27 күн бұрын
very nice and clear explanation.
@gpraneeth7693
@gpraneeth7693 2 ай бұрын
Helped a lot
@subee128
@subee128 3 ай бұрын
Thank you very much
@unknownman1
@unknownman1 3 ай бұрын
Thanks !
@vipul20465
@vipul20465 3 ай бұрын
Hey Nikhil, Thanks for the awesome explanation. I attempted to come up with a brute-force solution as per the explanation provided in the video to locate the kth positive element, but unfortunately, it's not passing all of the test cases. Could you please share the brute-force implementation of this problem.
@rambhaktuchihaobito7987
@rambhaktuchihaobito7987 2 күн бұрын
Thank you ..sir❤❤
@Adeetisharma-nu8jg
@Adeetisharma-nu8jg 20 күн бұрын
thankyou so much
@sumangupta5292
@sumangupta5292 2 ай бұрын
The explanation is excellent. However I have 2 questions - 1. Why we take right as arr.length and not arr.length-1 , 2. How did we arrive at return left + k?
@nikoo28
@nikoo28 Ай бұрын
1. to get a mid value, you are actually looking at the number of elements, and not the index. Thus, right will be the actual array length. 2. adding k to the 'left' will actually land you at the missing number.
@sksabir8063
@sksabir8063 29 күн бұрын
🤩
@adityaarya3249
@adityaarya3249 2 ай бұрын
Why didn't you take right = arr.length -1;
@sumangupta5292
@sumangupta5292 2 ай бұрын
I have the same question. Generally we take right pointer as arr.length-1
@je2587
@je2587 Ай бұрын
@@sumangupta5292 not sure if this answers your question but since we do while(left < right), we need to do right=arr.length before. If you go with arr.length-1, you would go with while(left
@jayeshpatil5757
@jayeshpatil5757 21 күн бұрын
19:04, 10 July , watching. Red cloth washed at 18:53,10 July.
A clash of kindness and indifference #shorts
00:17
Fabiosa Best Lifehacks
Рет қаралды 134 МЛН
ВОДА В СОЛО
00:20
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 30 МЛН
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 14 МЛН
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 383 М.
The moment we stopped understanding AI [AlexNet]
17:38
Welch Labs
Рет қаралды 810 М.
Leetcode 46. Permutations : Introduction to backtracking
10:06
ComputerBread
Рет қаралды 90 М.
Nature's Incredible ROTATING MOTOR (It’s Electric!) - Smarter Every Day 300
29:37
Pointers and dynamic memory - stack vs heap
17:26
mycodeschool
Рет қаралды 1,4 МЛН
Sliding Window Technique - Algorithmic Mental Models
36:45
Ryan Schachte
Рет қаралды 335 М.
A clash of kindness and indifference #shorts
00:17
Fabiosa Best Lifehacks
Рет қаралды 134 МЛН