Maximum Length Chain of Pairs | Dynamic Programming (Set 20) | GeeksforGeeks

preview_player
Показать описание

This video is contributed by Ishmeet Kaur

Please Like, Comment and Share the Video among your friends.

Also, Subscribe if you haven't already! :)
Рекомендации по теме
Комментарии
Автор

if you don't wanna explain what's the point of publishing this video

AnmolGera
Автор

There is a better solution for this problem with O(n log n)
1 We need to sort pairs by their ends increasingly
2 Set first pair as a tail and for each pair check if its start is bigger than tail end.
if true set is as a new tail and so on

MikePrice
Автор

There is no point in reading out a solution. We look for intuition behind a solution and how to come up with the idea for solving a question.

just_another_curious_guy
Автор

Even we can read what is written.. There is no point in publishing such videos

ishitagupta
Автор

You don't even need dp, you u can use a greedy approach after sorting second value of pairs

lakshmanmohanlanka
Автор

Thanks 2 mike.
bool compare(val a, val b )
{
return a.second < b.second;
}

int maxChainLen(struct val p[], int n)
{
sort(p, p+n, compare);
int count = 1;
struct val *temp = p;
for(int i=1; i<n; i++){
if(temp->second < p[i].first){
temp = p+i;
count++;
}
}
return count;
}

anjaneysharma
Автор

I followed this video tutorial to understand the solution, but this is even worst. Need better explanation rather than just narrating the code

LOKESHPANDEYjob
Автор

100 marks for English, 0 marks for teaching.

ShubhamKumar-fncl
Автор

This video is a waste of time. No explanation only running through the code.

bhagyashrichhapwale
Автор

Do not read the code. try to explain it in better way like how other guys do it. And please dont concentrate on your English accent. We are not here for TOEFL or IELTS. Try publishing this video again, else GeeksForGeeks will definitely loose subscribers

dynamogaming
Автор

Why you guys publish the video?
Please don't make such videos. You waste our time.

ayushkwal