filmov
tv
Longest Palindromic Substring using dynamic programming : step by step with intuition

Показать описание
Before watching this video do keep one thing in mind, never confuse longest common substring with longest common subsequence.
Both are different. Well the basic difference lies in the meaning of both.
1. Substring is a sequence of characters which are contiguous
2. Subsequence is also a sequence of characters which may be or may not be contiguous.
This means that a subsequence can be a substring but a substring can't be a subsequence.
In this video, I am going to teach you to solve longest palindromic substring using dynamic programming.
So, I did a video in which I told you about how to develop an intuition(link below) to come up with the solution of longest palindromic subsequence.
Well, the work on developing the intuition when it comes to longest palindromic substring is more or less the same but the difference lies in the approach.
Your approach can automatically be changed when you're going to give enough emphasis on the word substring.
Another thing which can greatly help you is go by the method using which we solved longest palindromic subsequence (link below) and apply the same in solving
the longest palindromic substring, you will come to know what I am talking about. Use this string 'dabcba'
After you have done the task and I am sure you're going to figure out where you're going wrong with the older method then only thing you have to do
is while constructing the dynamic programming algorithm at each subproblem you have to ask 'Is this a palindrome?'
If a subproblem is a palindrome then you're going to mention true there but if it is not then you have to mention it as false. Complete the matrix and then
it will tell you how to find out the length of the longest palindromic substring.
connection between different dynamic programming problems is the key to develop the intuition to solve DP problems.
So, with all the information with you let's watch this exciting video of Joey's dynamic programming tutorial series.
Both are different. Well the basic difference lies in the meaning of both.
1. Substring is a sequence of characters which are contiguous
2. Subsequence is also a sequence of characters which may be or may not be contiguous.
This means that a subsequence can be a substring but a substring can't be a subsequence.
In this video, I am going to teach you to solve longest palindromic substring using dynamic programming.
So, I did a video in which I told you about how to develop an intuition(link below) to come up with the solution of longest palindromic subsequence.
Well, the work on developing the intuition when it comes to longest palindromic substring is more or less the same but the difference lies in the approach.
Your approach can automatically be changed when you're going to give enough emphasis on the word substring.
Another thing which can greatly help you is go by the method using which we solved longest palindromic subsequence (link below) and apply the same in solving
the longest palindromic substring, you will come to know what I am talking about. Use this string 'dabcba'
After you have done the task and I am sure you're going to figure out where you're going wrong with the older method then only thing you have to do
is while constructing the dynamic programming algorithm at each subproblem you have to ask 'Is this a palindrome?'
If a subproblem is a palindrome then you're going to mention true there but if it is not then you have to mention it as false. Complete the matrix and then
it will tell you how to find out the length of the longest palindromic substring.
connection between different dynamic programming problems is the key to develop the intuition to solve DP problems.
So, with all the information with you let's watch this exciting video of Joey's dynamic programming tutorial series.
Комментарии