Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upLongest Palindromic Sub-sequence #235
Open
+61
−0
Conversation
|
|
||
| ### Filling of the matrix | ||
| Every single charecter contributes to a palindromic string of length 1 starting and ending at itself, therefore we fill the diagonal of the | ||
| matrix with 1 for every [i][i] entry. <br/><br/> |
prateekiiest
Dec 24, 2017
Member
make like this [i][i]
make like this [i][i]
| For every other entry:<br/> | ||
| If last and first characters of str are same, then mat[i][j] = mat[i+1][j-1] + 2, as it considers [2(for the first and the last chaar)] + | ||
| [longest palindromic subsequence between these 2 chars].<br/> | ||
| Else mat[i][j] = max(mat[i][j-1], mat[i+1][j]). |
prateekiiest
Dec 24, 2017
Member
similarly add ` before and after
similarly add ` before and after
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
ISSUE NUMBER
117
SHORT DESCRIPTION
Added the code for longest palindromic subsequence along with a readme.md for it.