Example
Input
s = 'aab'
Output
[['a', 'a', 'b'], ['aa', 'b']]
Two valid palindrome partitions: split into single letters or 'aa' + 'b'.
Full lesson preview
Return all possible palindrome partitions of a string via recursion and backtracking.
Problem statement
Task
Examples
Input
s = 'aab'
Output
[['a', 'a', 'b'], ['aa', 'b']]
Two valid palindrome partitions: split into single letters or 'aa' + 'b'.
Input format
Output format
Constraints
Samples
Input
s = 'aaa'
Output
[['a', 'a', 'a'], ['a', 'aa'], ['aa', 'a'], ['aaa']]
All palindromic ways to partition 'aaa'.