131_ Palindrome Partitioning
[Medium][String, Backtracking]
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
Example:
Solution:
Idea:
Focus on the first possible palindromic string in a partition.
The first string itself is a valid palindromic partition.
Do a linear search to find all the possible palindromic substring starting from the first letter.
Use recursion to deal with the left over.
Time Complexity: according to EPI page 236
Space Complexity: no extra space except for the output
Last updated