Тёмный
No video :(

DP 29. Minimum Insertions to Make String Palindrome 

take U forward
Подписаться 630 тыс.
Просмотров 143 тыс.
50% 1

Lecture Notes/C++/Java Codes: takeuforward.org/dynamic-prog...
Problem Link: bit.ly/3H2ZtGP
Pre-req for this Series: • Re 1. Introduction to ...
a
Make sure to join our telegram group for discussions: linktr.ee/takeUforward
Full Playlist: • Striver's Dynamic Prog...
In this video, we solve the minimum insertions to make a string palindrome, before watching this please make sure to watch the DP 28 video.
If you have not yet checked our SDE sheet, you should definitely do it: takeuforward.org/interviews/s...
You can also get in touch with me at my social handles: linktr.ee/takeUforward

Опубликовано:

 

4 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 339   
@shubhamrawat2353
@shubhamrawat2353 2 года назад
The ans for minimum no. of deletions to make a string palindrome will also be same because if we just remove the characters which are not a part of the lps(longest palindromic subsequence) we'll get the ans...which is same as n-len(lps)
@udatyadeb101
@udatyadeb101 Год назад
this is making more sense to me.......
@RajeevCanDev
@RajeevCanDev Год назад
Great 👍🏻
@priyanshkumar_iitd
@priyanshkumar_iitd Месяц назад
Yes, you're right. Thanks
@ranasauravsingh
@ranasauravsingh 2 года назад
TOTALLY UNDERSTOOD... !!! That just blew up my mind... Thank you striver for the video... :)
@elakkiahmasi8887
@elakkiahmasi8887 Год назад
Hi Striver, I have been following your videos for the past three months and dp series since last week. I really had to admit how graceful you are in teaching, I thank you a lot for your contribution and today I solved myself this question without looking into the solution and now I am going to watch it to make a note of your points if I had missed anything. And since I started your dp series, I have handwritten all the things that you had said and I am also finding it very useful for revision. Thanks again
@BeatXRitik
@BeatXRitik 3 месяца назад
Can you send me those notes
@rishavsaha5254
@rishavsaha5254 2 года назад
Previously, I heard that DP is some sort of topic, people use to leave, but now after watching each and every video of Striver, I must say you just made it the easiest. Write the recursion -> change it to memoization -> change it to tabulation. And the relation you develop between questions, is just incredible. Keep growing.
@pranavsharma7479
@pranavsharma7479 2 года назад
dp is a marathon not that tuff , if teacher is good its a cakewalk
@MayankLC93
@MayankLC93 Год назад
i did this by own !!! i am loving it that i came up to the solution by own . Thank You Striver !!
@sahilgagan2242
@sahilgagan2242 2 года назад
52% done .... striver bro u build my logic ... now i can solve any pattern of dp taught till now .... and also i solved all the problems by myself when u just write sudo code for new topic .... thanks striver bro ...
@immortal6978
@immortal6978 8 месяцев назад
I initially tried with my own and with way you teach I was able to solve it by my own. Thanks understood one more lecture.
@aniruddhakotal1534
@aniruddhakotal1534 10 месяцев назад
hats off to you !!! Proved that , every topic is easy if you got the right teachings..
@zerr0n7eet
@zerr0n7eet Год назад
Solved this without even watching. Thanks bro
@uditgarg6508
@uditgarg6508 2 месяца назад
me too
@ishangujarathi10
@ishangujarathi10 Год назад
man GOD level stuff Striverrr, it was a leetcode HARD problem, but the logic you told makes it look a EASY level problem!!!! Thanks a lotttt!!
@ritikshandilya7075
@ritikshandilya7075 Месяц назад
Amazing , thanks Striver
@andrewcenteno3462
@andrewcenteno3462 20 часов назад
Beautiful explanation. 0% chance I would figure that out at an interview tho, if i didn't already know it
@anujrathore5726
@anujrathore5726 Месяц назад
did this que by myself , thank you striver
@pulkitchausali1354
@pulkitchausali1354 Год назад
"Logic formed just by seeing example test cases" came to video to insure that i am thinking right THANKU Striver
@aadithyaseshadri9597
@aadithyaseshadri9597 Год назад
Understood! A small clarification - at 8:35 , when you kept the palindromic section in tact, shouldn't you have taken "cod" instead of "codi" while switching? That along with "sajn" would give the minimum insertions to be 3+4 = 7 right?
@paramsratanpal6551
@paramsratanpal6551 Год назад
ya it was by mistake he did
@stith_pragya
@stith_pragya 7 месяцев назад
UNDERSTOOD.......Thank You So Much for this wonderful video...........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
@user-or7xr2mt3o
@user-or7xr2mt3o Год назад
Understood....the way u explain DP, seems like DP is piece of cake!!
@vikashkumar7762
@vikashkumar7762 2 года назад
Waoooh... Previous lecture concept move this LC hard level question to medium level
@worldofniyathi
@worldofniyathi 2 месяца назад
hats off to you
@johncenakiwi
@johncenakiwi 2 года назад
Understood!! LCS pattern can help us solve so many problems!! Thanks Striver
@Mojemoye
@Mojemoye 2 года назад
LCS?? What's LCS, He was saying LPS or LCS!??
@xboow8147
@xboow8147 2 года назад
@@Mojemoye LONGEST COMMON SUBSEQUENCE
@paramsratanpal6551
@paramsratanpal6551 Год назад
@@Mojemoye lps will also be done by lcs
@pqrstwxyz1175
@pqrstwxyz1175 7 месяцев назад
One question; Is LCS pattern enough for solving any dp on string problem?
@adebisisheriff159
@adebisisheriff159 7 месяцев назад
Thanks a lot bro..... I really appreciate you!
@DevashishJose
@DevashishJose 7 месяцев назад
understood, thank you so much.
@VivekSharma-eh2tv
@VivekSharma-eh2tv Месяц назад
understood striver !!!
@harshvardhansingh2272
@harshvardhansingh2272 Год назад
man hatsoff to you striver Intuition just clicked in by just seeing the topic of video, and converted it into code under just 5 mins and easily did a leetcode hard problem so thanks again striver for such an amazing content
@cinime
@cinime 2 года назад
Understood! I really really appreciate for your explanation!!
@Hrushi_2000
@Hrushi_2000 10 месяцев назад
Understood. Thankyou sir
@hashcodez757
@hashcodez757 2 дня назад
"UNDERSTOOD BHAIYA!!"
@harshitjaiswal9439
@harshitjaiswal9439 Год назад
8:06 promotion at its best XD. Understood as always Striver!
@shivisingh9975
@shivisingh9975 3 месяца назад
Understood sir!
@sooyashjaju4208
@sooyashjaju4208 Год назад
Minimum Insertions To make palindrome = (length of string - * length of longest palindromic Subsequence *) [DP 29], and Length of Longest palindromic Subsequence = (* longest common Subsequence * between String and its Reverse ) [DP 28] And longest common Subsequence, we know it already !! [DP 25] What a link ! matlab questions naye ate jaa rhe h bss , baki jitna sikha h unhi me se uska solution mil rha h, thoda observation acha ho toh 😀 man gye bhai ! ❤ Itni ache se design ki h playlist ki aap gadhe se Gadhe ko bhi sikha skhtein ho, bs uski sikhne ki ichha ho
@devanshsharma2106
@devanshsharma2106 2 года назад
got the logic just after your first exmaple. Thank you Raj bhaiya
@MP-ny3ep
@MP-ny3ep Год назад
Terrific explanation. Thank you so much !!!
@prabhakaran5542
@prabhakaran5542 4 месяца назад
Understood ❤
@nick-cf3jy
@nick-cf3jy 24 дня назад
great video
@tasneemayham974
@tasneemayham974 10 месяцев назад
BESTTT TEACHERRR EVERRR!!!!!!!!!!!!!!!!1
@gunduboinadileep9523
@gunduboinadileep9523 8 месяцев назад
understood!!.
@ratinderpalsingh5909
@ratinderpalsingh5909 2 года назад
Understood, sir. Thank you very much.
@ramakrishnakcr4417
@ramakrishnakcr4417 5 месяцев назад
thank you
@UECAshutoshKumar
@UECAshutoshKumar Месяц назад
Thank You Understood!!!!!
@himanshukhurana9357
@himanshukhurana9357 7 месяцев назад
understood!
@user-qi3eh5jq4v
@user-qi3eh5jq4v 2 года назад
Bhaiyaa we are so so grateful for your content and effort🙏❤
@chitranshjain5075
@chitranshjain5075 2 года назад
Understood. Amazing explanation!
@gyanaranjansahoo6258
@gyanaranjansahoo6258 Год назад
Bhaiya i understood the concepts upto dp on subsequences very well also did the questions without watching or seeing the solutions but this dp on string topic , i understand the solution properly but can't do problem by my own . Anyway ... understoo the solution. Thanks ❤
@saurabhrthakur
@saurabhrthakur 3 месяца назад
Understood!
@alifarah9
@alifarah9 2 года назад
please do word break & word break ii. thanks
@sameersahu4569
@sameersahu4569 2 года назад
Understood!!!Thank you
@pragyanandsingh6673
@pragyanandsingh6673 5 месяцев назад
Understood !!
@shreyasnagabhushan4918
@shreyasnagabhushan4918 Год назад
understood sir, u are amazing , love the way u teach.
@CEBMANURBHAVARYA
@CEBMANURBHAVARYA Год назад
demn i just tried the question first without starting video, just changed return dp[n][n] to n-dp[n][n], and lol it worked, and on leetcode it was a hard ques, I didn't believe, so I saw ur video, and yea it was indeed easy, after doing the LPS ques.
@radharamamohanakunnattur3035
Awesome!! Understood!!
@priyanshu6173
@priyanshu6173 4 месяца назад
This is a Hard category question on leetcode but u made it a piece of cake lmao ❤
@keshavprasad1017
@keshavprasad1017 10 месяцев назад
Best❤
@aruna5869
@aruna5869 5 месяцев назад
understood :)❤
@Harshit126
@Harshit126 2 года назад
Understood, thanks a ton
@theresilientpianist7114
@theresilientpianist7114 20 дней назад
understood.
@dharmaraosalana7977
@dharmaraosalana7977 Год назад
your videos are awesome. Please suggest system design related training
@kumarpurushottam632
@kumarpurushottam632 Год назад
Understood Thanks Striver ❤
@sachinkore974
@sachinkore974 Год назад
got the idea @ 5:19 we can do length()-LPS thank you striver for such amazing videos
@rishabhagarwal8049
@rishabhagarwal8049 Год назад
Understood Sir thank you very much
@srinathv1412
@srinathv1412 6 месяцев назад
Understood !!!!!
@mohitagarwal3639
@mohitagarwal3639 2 года назад
i did this question in another way and that is accepted with 100 % score. Kindly take a look.... Memoized solution - int f(int l, int r, string &str, vector &dp) { if (l >= r) return 0; if (dp[l][r] != -1) return dp[l][r]; if (str[l] == str[r]) return dp[l][r] = f(l + 1, r - 1, str, dp); else return dp[l][r] = 1 + min(f(l + 1, r, str, dp), f(l, r - 1, str, dp)); } int minInsertion(string &str) { int n = str.size(); int a = 0, b = str.size() - 1; vector dp(n, vector(n, -1)); return f(a, b, str, dp); } Tabulation - int minInsertion(string &str) { int n = str.size(); int a = 0, b = str.size() - 1; vector dp(n, vector(n, 0)); for (int l = n - 2; l >= 0; l--) { for (int r = l + 1; r < n; r++) { if (str[l] == str[r]) dp[l][r] = dp[l + 1][r - 1]; else dp[l][r] = 1 + min(dp[l + 1][r], dp[l][r - 1]); } } return dp[a][b]; } Thanks Striver for this complete DP playlist.
@rohanrauniyar6713
@rohanrauniyar6713 2 года назад
what is your dp state?? means what dp[i][j] represent
@jollydasgupta2913
@jollydasgupta2913 Месяц назад
stack space for memoized solution is O(2N) right?
@atindraask8074
@atindraask8074 2 месяца назад
Understood
@geetamohankollu7990
@geetamohankollu7990 2 года назад
We are glad to have u brother
@rahulsidhu5945
@rahulsidhu5945 Год назад
Just want to say... You are awesome striver😇😇
@Lucky1729-pn7ww
@Lucky1729-pn7ww 3 месяца назад
understood
@gauravkumar6632
@gauravkumar6632 2 года назад
Striver thankyou first time in dp i did this question without watched your video thanks
@niteshmodi5468
@niteshmodi5468 10 месяцев назад
ye badhiya tha guru...ji...
@whtthywnt4259
@whtthywnt4259 2 года назад
All Character (at opposite position) which are not part of longest palindromic subsequence
@bhavya8608
@bhavya8608 Год назад
understooodd!!!!
@logeshkumar9992
@logeshkumar9992 Год назад
how can we print the modified string which will be palindrome string after minimum no operations
@herculean6748
@herculean6748 Год назад
US, mindblowing explanation
@johar3737
@johar3737 Год назад
Understood. You made dp easy.
@shubhigupta5689
@shubhigupta5689 Год назад
Understood🌻
@akashkumarsingh3595
@akashkumarsingh3595 2 года назад
Understood🔥🔥
@yikes3807
@yikes3807 Год назад
bro made leetcode hard look like a lollypop thanks striver loving this dp series
@karthikeyansivakkumar5075
@karthikeyansivakkumar5075 2 года назад
Understood Bhai. Have a request. Is it possible to explain the logic and code for the "look and say" or "count and say" problem bro? thanks in advance. it would really help if you could.
@himanshuagrawal8012
@himanshuagrawal8012 2 года назад
LCS is just Like Striver....It helps us to solve most of the problems ........Sorry for the PJ #UNDERSTOOD
@aryansinha1818
@aryansinha1818 Год назад
*As we are not passing the string by reference '&' then also the code is running fine, can anyone explain this*
@chakradharthota1100
@chakradharthota1100 Год назад
understood 👍
@shravan9796
@shravan9796 2 года назад
understood bhai , thanks !
@shivaliraghav8524
@shivaliraghav8524 Год назад
Great!!
@arihantjammar8888
@arihantjammar8888 9 месяцев назад
😅 Understood 😊
@fragz8376
@fragz8376 Год назад
understood 29/57 completed!
@ishanminhas4676
@ishanminhas4676 2 года назад
Thanks
@piyushupadhyay4981
@piyushupadhyay4981 Год назад
Understood !!!🥰🥰🥰
@VikashYadav-px8ei
@VikashYadav-px8ei Год назад
Understood 🎉
@vinitkumawat2335
@vinitkumawat2335 Год назад
Understood❤
@shubhansu-kr
@shubhansu-kr 2 года назад
Enlightenment
@suhaanbhandary4009
@suhaanbhandary4009 Год назад
understood!!
@Ajay-ei2jo
@Ajay-ei2jo Год назад
Understood 👍
@PIYUSH61004
@PIYUSH61004 2 года назад
How to print the converted string? I mean after insertions, The final palindromic string
@visase2036
@visase2036 Год назад
Seems to be very tough!
@Hello-ro6hr
@Hello-ro6hr 2 года назад
UNDERSTOOD ...
@anshumangupta1001
@anshumangupta1001 Год назад
Understood.
@RitikKumar-bk6pj
@RitikKumar-bk6pj 2 года назад
Bhaiya muje string ke question mai bilkul confident nhi hai mai wo kese strong kru aapne?
@priyanshvatsal9791
@priyanshvatsal9791 Год назад
Understood 🥰
@amansamal8233
@amansamal8233 2 года назад
understood bhaiya❤❤
@ayanangshudasmajumder112
@ayanangshudasmajumder112 11 месяцев назад
Understood!!!
@p38_amankuldeep75
@p38_amankuldeep75 Год назад
understood❤❤❤
@googleit2490
@googleit2490 8 месяцев назад
Done and dusted in DP revision Nov'14, 2023 05:54 pm
@parthsalat
@parthsalat 2 года назад
Understood kaka!
Далее
DP 28. Longest Palindromic Subsequence
9:38
Просмотров 228 тыс.
Китайка Шрек всех Сожрал😂😆
00:20
ЮТУБ ТОЧНО ВСЕ!
11:23
Просмотров 1 млн
Longest palindromic substring | Dynamic programming
15:21
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Longest Palindromic Substring - Python - Leetcode 5
8:11