Palindrome Partitioning
Return all ways to split s into contiguous nonempty palindromes. Preserve substring order within each partition; result order is unrestricted.
Example 1
s = "aab"[["a","a","b"],["aa","b"]]Explanation
aab splits as a/a/b or aa/b; the entire string is not palindromic.
Example 2
s = "aba"[["a","b","a"],["aba"]]Explanation
aba stays whole or splits into single letters; ab and ba are invalid pieces.
Example 3
s = "x"[["x"]]Explanation
A one-letter string has one partition.
Constraints
- 1 <= len(s) <= 16
- s contains lowercase English letters
Function contract
partitionArguments: jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 35 cases, on your device.
"aab"