Geeksforgeeks

X

DAYS

:

HOUR

:

MINS

:

SEC

Error

Copied to Clipboard

Given a String **S, **Find all possible Palindromic partitions of the given String.

**Example 1:**

Input: S ="geeks"Output:g e e k s g ee k sExplanation:All possible palindromic partitions are printed.

**Example 2:**

Input: S ="madam"Output:m a d a m m ada m madam

**Your Task:**

You don't need to read input or print anything. Your task is to complete the function **allPalindromicPerms()** which takes a String S as input parameter and returns a list of lists denoting all the possible palindromic partitions in the order of their appearance in the original string.

**Expected Time Complexity:** O(N*2^{N})

**Expected Auxiliary Space:** O(N^{2}), where N is the length of the String

**Constraints:**

1 <= |S| <= 20

We are replacing the old Disqus forum with the new Discussions section given below.

Click here to view old Disqus comments.

Click here to view old Disqus comments.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

YesLoading...

Find all possible palindromic partitions of a String

...