Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Programmig:- Longest Palindromic Subsequence #1709

Closed
projectelex opened this issue Oct 9, 2020 · 4 comments
Closed

Dynamic Programmig:- Longest Palindromic Subsequence #1709

projectelex opened this issue Oct 9, 2020 · 4 comments

Comments

@projectelex
Copy link

@projectelex projectelex commented Oct 9, 2020

Longest Palindromic Subsequence is a type of subsequence in which the two strings are considered Eg:-
String 1:- BBABCBCAB
String 2:- BABCBAB

The result i.e. the Longest Palindrimic Subsequence from the above two strings is:
Result 1:- BBBBB
Result 2:-BBCBB

@matteomessmer
Copy link
Contributor

@matteomessmer matteomessmer commented Oct 9, 2020

I can do this

@matteomessmer
Copy link
Contributor

@matteomessmer matteomessmer commented Oct 9, 2020

Ok I finished, but the results of my algorithm are different from the two test cases you wrote.
Are you sure that the LPS of "BBABCBCAB" is "BBBBB"? Shouldn't it be "BABCBAB"? And also the second string "BABCBAB" is a palindrome itself, hence it is already its longest palindromic subsequence. Or maybe I missed something, I'm not 100% sure I understood what you mean with LPS.
Tell me if I shall make a pull request

@projectelex
Copy link
Author

@projectelex projectelex commented Oct 9, 2020

Yes you are right my also answer came to be a length of 7. It was a mistake from me

@matteomessmer
Copy link
Contributor

@matteomessmer matteomessmer commented Oct 9, 2020

Ok, thank you. I make the pull request

@matteomessmer matteomessmer mentioned this issue Oct 9, 2020
10 of 12 tasks complete
@rbshealy rbshealy closed this in 9bcb7f5 Oct 14, 2020
rbshealy added a commit that referenced this issue Oct 14, 2020
…ence

Fixes: #1709 Longest palindromic subsequence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.