From e3ebc46bd76c6bd7aa271d19a2b3f615093b93e7 Mon Sep 17 00:00:00 2001 From: Aasif9 <62379306+Aasif9@users.noreply.github.com> Date: Thu, 21 Oct 2021 23:28:59 +0530 Subject: [PATCH] Implemented Longest Palindrome Subsequence in cpp We have to find the longest palindromic subsequence of a string --- .../cpp/longestPalindromeSub.cpp | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 data_structures/longest_palindromeSubsequence/cpp/longestPalindromeSub.cpp diff --git a/data_structures/longest_palindromeSubsequence/cpp/longestPalindromeSub.cpp b/data_structures/longest_palindromeSubsequence/cpp/longestPalindromeSub.cpp new file mode 100644 index 00000000..e5f73daf --- /dev/null +++ b/data_structures/longest_palindromeSubsequence/cpp/longestPalindromeSub.cpp @@ -0,0 +1,40 @@ +#include +using namespace std; + +int longestPalinSub(string str) { + + int n=str.size(); + + int dp[n][n]={0}; + + for(int l=0;l>str; + cout<< longestPalinSub(str); +}