Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7b351a6

Browse files
Create Longest Palindromic Subsequence.txt
1 parent 063e3f9 commit 7b351a6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Given a sequence, find the length and string of the longest palindromic subsequence in it.
2+
3+
Example, if the given sequence is "BBABCBCAB", then the output should be 7 as "BABCBAB" is the longest palindromic subsequence in it.
4+
"BBBBB" and "BBCBB" are also palindromic subsequences of the given sequence, but not the longest ones.
5+
6+
The naive solution for this problem is to generate all subsequences of the given sequence and find the longest palindromic subsequence.
7+
This solution is exponential in term of time complexity. Let us see how this problem possesses both important properties of a Dynamic Programming (DP)
8+
Problem and can efficiently be solved using Dynamic Programming.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /