Kth Missing Positive Number || Binary Search || 2-Pointers || Leetcode-1539

preview_player
Показать описание
In this video, I'll talk about how to solve the problem - Kth Missing Positive Number - here we solve this by || 2-Pointers || Binary Search Algorithm.

Let's Connect:

Resources you can try:

🎥Channel Playlists

About Channel:
We teach about how you can grow in life & educate about programming in Fun way.

About Me:
I am Aryan Mittal - a Software Engineer, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)

✨ Tags ✨

✨ Hashtags ✨
#skills #college #studentslife #students #teenager #life #teenagers #makemoney #students
Рекомендации по теме
Комментарии
Автор

Not working with testcase k =1 and array {32, 59, 77} ans should be 33 according to gfg.

aryangupta
Автор

public int findKthPositive(int[] arr, int k) { //brute force(Two pointer)(O(n))
int num=1;
int count=0;
for(int i=0;i<arr.length;i++){
if(num < arr[i]){
count++;
i--;
}
if(count==k){
break;
}
num++;
}
if(count<k){
return arr.length + k;
}
return num;
}

abhaykumarsingh
Автор

why there is l+k at the last, and why not r+k?

rakibulhasanrumon
join shbcf.ru