{"id":"7e972039-fd89-4491-84bf-4f991445fd44","name":"Minimum Deletions To Make Palindromic Sequence","description":"1. You are given a string of characters(a-z,A-Z).\r\n2. Find the minimum number of deletions/removals needed such that remaining characters are palindromic.\r\n","inputFormat":"A string","outputFormat":"Find the minimum number of deletions/removals.\r\nCheck the sample output and question video.\r\n","constraints":"1 <= length(str) <= 10000","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.Scanner;\r\npublic class Main{\r\n public static int minimumDeletionsToPalindrome(String str){\r\n // write your code here\r\n return -1;\r\n }\r\n public static void main(String []args){\r\n Scanner scn = new Scanner(System.in);\r\n String str = scn.nextLine();\r\n\r\n System.out.println(minimumDeletionsToPalindrome(str));\r\n }\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"adceadfahg","sampleOutput":"5\r\n","questionVideo":"","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":"1ee90a75-1600-40e7-b230-ca2f74f93b82","name":"Minimum Deletions To Make Palindromic Sequence","slug":"minimum-deletions-to-make-palindromic-sequence","type":1}],"next":{"id":"3ab234cf-305f-4a78-81a3-63af4ed19898","name":"Minimum Deletions To Make Sorted Array","type":1,"slug":"minimum-deletions-to-make-sorted-array"},"prev":{"id":"472e4593-cc90-46c2-a929-2b7d9515a134","name":"Linear Equation Of N Variables","type":1,"slug":"linear-equation-of-n-variables"}}}

Minimum Deletions To Make Palindromic Sequence

1. You are given a string of characters(a-z,A-Z). 2. Find the minimum number of deletions/removals needed such that remaining characters are palindromic.

{"id":"7e972039-fd89-4491-84bf-4f991445fd44","name":"Minimum Deletions To Make Palindromic Sequence","description":"1. You are given a string of characters(a-z,A-Z).\r\n2. Find the minimum number of deletions/removals needed such that remaining characters are palindromic.\r\n","inputFormat":"A string","outputFormat":"Find the minimum number of deletions/removals.\r\nCheck the sample output and question video.\r\n","constraints":"1 <= length(str) <= 10000","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.util.Scanner;\r\npublic class Main{\r\n public static int minimumDeletionsToPalindrome(String str){\r\n // write your code here\r\n return -1;\r\n }\r\n public static void main(String []args){\r\n Scanner scn = new Scanner(System.in);\r\n String str = scn.nextLine();\r\n\r\n System.out.println(minimumDeletionsToPalindrome(str));\r\n }\r\n}"},"node":{"code":""},"ruby":{"code":""},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"adceadfahg","sampleOutput":"5\r\n","questionVideo":"","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":"1ee90a75-1600-40e7-b230-ca2f74f93b82","name":"Minimum Deletions To Make Palindromic Sequence","slug":"minimum-deletions-to-make-palindromic-sequence","type":1}],"next":{"id":"3ab234cf-305f-4a78-81a3-63af4ed19898","name":"Minimum Deletions To Make Sorted Array","type":1,"slug":"minimum-deletions-to-make-sorted-array"},"prev":{"id":"472e4593-cc90-46c2-a929-2b7d9515a134","name":"Linear Equation Of N Variables","type":1,"slug":"linear-equation-of-n-variables"}}}
plane

Editor


Loading...

Minimum Deletions To Make Palindromic Sequence

easy

1. You are given a string of characters(a-z,A-Z). 2. Find the minimum number of deletions/removals needed such that remaining characters are palindromic.

Constraints

1 <= length(str) <= 10000

Format

Input

A string

Output

Find the minimum number of deletions/removals. Check the sample output and question video.

Example

Sample Input

adceadfahg

Sample Output

5

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode