New update is available. Click here to update.
Close
Topic list
Palindrome Partitioning
MEDIUM
25 mins
Strings
Dynamic Programming
Topics (Covered in this problem)
Problem solved
Skill meter
Strings
-
-
Dynamic Programming
-
-
Other topics
Problem solved
Skill meter
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Palindrome Partitioning

Contributed by
Ashwani
Medium
0/80
Avg time to solve 25 mins
Success Rate 75 %
Share

## Problem Statement

#### Note: A substring is a contiguous segment of a string.

##### For Example:
``````For a given string “BaaB”
3 possible palindrome partitioning of the given string are:
{“B”, “a”, “a”, “B”}
{“B”, “aa”, “B”}
{“BaaB”}
Every substring of all the above partitions of “BaaB” is a palindrome.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1:
``````aaC
``````
##### Sample Output 1:
``````["C", "a", "a"]
["C", "aa"]
``````
##### Explanation for input 1:
``````For the given string "aaC" there are two partitions in which all substring of partition is a palindrome.
``````
##### Sample Input 2:
``````BaaB
``````
##### Sample Output 2:
``````["B", "B", "a", "a"]
["B", "B", "aa"]
["BaaB"]
``````
##### Explanation for input 2:
``````For the given string "BaaB", there are 3 partitions that can be made in which every substring is palindromic substrings.
``````
Auto
Console