{"id":"8e8b0c81-b6f5-4c18-b2c3-820552521a65","name":"Longest Palindromic Subsequences","description":"1. You are given a string str.\r\n2. You are required to print the length of longest palindromic subsequence of string str.","inputFormat":"A string str","outputFormat":"A number representing the length of longest palindromic subsequence of string str.","constraints":"0 <= str.length <= 10","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws Exception {\r\n\r\n }\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"abcgackbc","sampleOutput":"5","questionVideo":"https://www.youtube.com/embed/RiNzHfoA2Lo?end=32","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"70099256-e13a-4657-8a2a-5fab8e5d7dcb","name":"Longest Palindromic Subsequences","slug":"longest-palindromic-subsequences","type":1}],"next":{"id":"8eccc981-b420-4757-8668-f75aba7d2b3f","name":"Longest Palindromic Substring","type":1,"slug":"longest-palindromic-substring"},"prev":{"id":"f90da01a-c2ba-4d16-ae42-046722214bb4","name":"Longest Common Subsequence","type":1,"slug":"longest-common-subsequence"}}}

Longest Palindromic Subsequences

1. You are given a string str. 2. You are required to print the length of longest palindromic subsequence of string str.

{"id":"8e8b0c81-b6f5-4c18-b2c3-820552521a65","name":"Longest Palindromic Subsequences","description":"1. You are given a string str.\r\n2. You are required to print the length of longest palindromic subsequence of string str.","inputFormat":"A string str","outputFormat":"A number representing the length of longest palindromic subsequence of string str.","constraints":"0 <= str.length <= 10","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws Exception {\r\n\r\n }\r\n\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"medium","sampleInput":"abcgackbc","sampleOutput":"5","questionVideo":"https://www.youtube.com/embed/RiNzHfoA2Lo?end=32","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"5539a6e8-c8bf-4f04-805c-e43e9d20e72a","name":"Dynamic Programming For Intermediate","slug":"dynamic-programming-for-intermediate-408","type":0},{"id":"70099256-e13a-4657-8a2a-5fab8e5d7dcb","name":"Longest Palindromic Subsequences","slug":"longest-palindromic-subsequences","type":1}],"next":{"id":"8eccc981-b420-4757-8668-f75aba7d2b3f","name":"Longest Palindromic Substring","type":1,"slug":"longest-palindromic-substring"},"prev":{"id":"f90da01a-c2ba-4d16-ae42-046722214bb4","name":"Longest Common Subsequence","type":1,"slug":"longest-common-subsequence"}}}
plane

Editor


Loading...

Longest Palindromic Subsequences

medium

1. You are given a string str. 2. You are required to print the length of longest palindromic subsequence of string str.

Constraints

0 <= str.length <= 10

Format

Input

A string str

Output

A number representing the length of longest palindromic subsequence of string str.

Example

Sample Input

abcgackbc

Sample Output

5

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode