Palindrome Partitioning
Given a string s, partition it so that every contiguous substring in the partition is a palindrome. Return all possible palindrome partitionings of s.
Open official problem prompt ↗Enumerate every way to slice the string into contiguous chunks such that each chunk reads the same forwards and backwards.
Like cutting a ribbon printed with letters into pieces, but you are only allowed to keep a cut set where every piece is a symmetric word; you try each possible cut and undo it if the rest cannot be completed.
- Input
- s = "aab"
- Output
- [["a","a","b"],["aa","b"]]
- Why
- Cutting after each 'a' gives palindromes a, a, b; cutting after 'aa' gives palindromes aa, b. No other cut set is fully palindromic.
1 <= s.length <= 16s consists of lowercase English letters only