131. Palindrome Partitioning

Practice Palindrome Partitioning for free on NudgeCode: Medium, Backtracking pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Cut s into pieces so that every piece reads the same forwards and backwards. Return every such way of cutting it. Each partition lists its pieces in the order they appear in s; the partitions themselves can be in any order.

Example

s = "aab"  ->  [["a","a","b"],["aa","b"]]

Constraints