Find if a string is k-palindrome using dynamic programming technique

preview_player
Показать описание
A cool addition to Joey's dynamic programming tutorial in which you need to find if a string is k-palindrome or not.

The statement of this DP problem states the following -

You are provided a string

' a b c e d b c a '

And a variable K = 2

All you need to do is to find out if the string is k-palindrome. A K-palindrome means whether this string can be converted in a palindrome by removing k or less than k characters from it.

So, you can see that if you remove 'e' and 'b' then this string becomes a palindrome hence, this string is a K-Palindrome because the number of removed characters is exactly
equal to the value of k.

This is a very interesting dynamic programming problem which is very similar to the minimum edit distance problem.
I have already made a video on the minimum edit distance problem in which I have solved it using the dynamic programming technique.

To get a better hold of the problem I recommend you to watch it first. Here is the link below -
Рекомендации по теме
Комментарии
Автор

• 🙏🙏It was fabulous . just provide 👍👍exact clarity . 😍😍what I was👍👍 looking for 👌👌

computerlearningbyargusaca
Автор

Thanks for breaking down these DP problems in ways that make them much easier to understand.

chrisogonas
Автор

wao you acttually explain everything very very detailed, I have never seen that explanation before, they just initialize the table with first row and column being zero and give me the formula, I don't understand what they do and how the logic work but you actually help me understand everything in that.Thank you sir!!

ucanhly
Автор

12:11 how come the minimum value is 2 instead of 1 ? are we only considering the one row back and one column back cells ? what about the diagonal previous cell one row and one column back cell ?

joydeeprony
Автор

Great explanation, One doubt? Will it always be the case that final value is even? How can we visualize that?

SHUBHAMKUMAR-yyto
Автор

What if we simply calculate longest palindromic subsequence length of given string and check if (given string length - LPS) <= k?
Do you think it will work?

ravitiwari
Автор

Btw are u a working professional in any software company?

ayushmishra