OpenGenus / cosmos

World's largest Contributor driven code dataset | Used in Quark Search Engine, @OpenGenus IQ, OpenGenus Visual Project
http://internship.opengenus.org
GNU General Public License v3.0
13.57k stars 3.68k forks source link

Add longest palindromic sequence solution in any language #1319

Open Vitorvgc opened 7 years ago

Vitorvgc commented 7 years ago

Add the code for the longest palindromic sequence problem in any language.

Problem statement: Given a string S, find the length of the longest subsequence of S that is a palindrome.

The code should be placed at code/dynamic_programming/longest_palindromic_sequence.

For contribution guidelines, see this.

Vitorvgc commented 7 years ago

Added C++ implementation: #1320

pedroperrusi commented 7 years ago

Hey,

I'm working on a longest_palindromic_sequence.py implementation. My plan is to merge both of these solutions into ours. (here, and here).

I hope to be able to help.

Vitorvgc commented 7 years ago

An efficient algorithm to solve this problem uses dynamic programming. You can check an explanation on this problem here.

pedroperrusi commented 7 years ago

Wow, Thanks for the heads up and nice reference.

pedroperrusi commented 7 years ago

Let me know if there may be any improvements on the pull request.