Longest String Chain | Live Coding with Explanation | Leetcode - 1048

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

To support us you can donate

Check out our other popular playlists:
Questions you might like:

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.

#coding #leetcode #programminglife #programmingisfun #programmer #tech #software #codinglife #leetcode
Рекомендации по теме
Комментарии
Автор

U guys really have a gift of explaining the toughest algorithms in an easy way, hats off 😀

anuragtiwari
Автор

This is the best explanation video I have come across so far.. Thank you for sharing.

vaibhavipatel
Автор

Made it easy and thanks for the explanation for calculating complexities..

i.vigneshdavid
Автор

Very helpful video, you explained it so well.

anuragharsh
Автор

The channel name is worth it. Kudos !!

aakashyadav
Автор

WOW the explanation is seemless. thank you so much

chiamakabrowneyes
Автор

Thank you for your explanation. Clear as crystal!

xueli
Автор

This is a smooth and easy explanation for a difficult problem, Thank you for putting time and effort for helping others

wesammustafa
Автор

You both are doing great work...keep up the good work 🏆👍.you are explaining the algorithm superbly.please make more video

sameer
Автор

I learned a lot of things only by this particular problem and definitely u made it very easy.. that's why i am able to grasp all the concepts used here....#Best!!

adarshdubey
Автор

TBH, It was the best solution ever which I was ever seen and explanation

ajithkannan
Автор

Thanks it's super clear but I would say it's really hard to come up with this dp solution in an interview if you havn't solved problems like this

shubinwu
Автор

Very well explained . Aise hi video banate rahe toh .. Aapke subscribers FAANG maine work karenge . Phir unse salary ka 5 percent jarur lena . Guru dikshika maine .

prithvirajrathore
Автор

class Solution {
public:
static bool comp(string &a, string &b){
return a.length()<=b.length();
}
int words) {
sort(words.begin(), words.end(), comp);
unordered_map <string, int> dp;
int res=1;
for (auto u:words){
dp[u]=1;
for (int i=0;i<u.length();i++){
string leftPart=u.substr(0, i);
string rightPart=u.substr(i+1);
string newString=leftPart+rightPart;
if
dp[u]=max(dp[u], 1+dp[newString]);
}
}
res=max(res, dp[u]);
}
return res;
}
};

I tried to code this in C++, it's working completely fine for sample test cases but gives runtime error when I try to submit. What might be the issue here?

girikgarg