Given a string, find all possible palindromic partitions of given string.
Note that this problem is different from Palindrome Partitioning Problem, there the task was to find the partitioning with minimum cuts in input string. Here we need to print all possible partitions.
The idea is to go through every substring starting from first character, check if it is palindrome. If yes, then add the substring to solution and recur for remaining part. Below is complete algorithm.
Below is the implementation of above idea.
n i t i n n iti n nitin
This article is contributed by Ekta Goel. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Print all palindromic partitions of a string
- Print all possible palindromic string formed using any pair of given strings
- Minimum cuts required to convert a palindromic string to a different palindromic string
- Lengths of maximized partitions of a string such that each character of the string appears in one substring
- Maximized partitions of a string such that each character of the string appears in one substring
- Make palindromic string non-palindromic by rearranging its letters
- Print all the palindromic permutations of given string in alphabetic order
- Sum of elements of all partitions of number such that no element is less than K
- Generate all unique partitions of an integer | Set 2
- Longest Palindromic Substring using Palindromic Tree | Set 3
- Largest palindromic string possible from given strings by rearranging the characters
- Longest palindromic string possible by concatenating strings from a given array
- Print the longest palindromic prefix of a given string
- Split string into three palindromic substrings with earliest possible cuts
- Longest palindromic string possible after removal of a substring
- Print all possible combinations of the string by replacing '$' with any other digit from the string
- Find maximum subset sum formed by partitioning any subset of array into 2 partitions with equal sum
- Maximize partitions such that no two substrings have any common character
- Find all distinct palindromic sub-strings of a given string
- Find all palindromic sub-strings of a given string | Set 2