Palindrome Partitioning

Backtracking Palindrome Recursive

Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.

For example, given:

Input: "aab"

A valid output would be:

[
  ["a", "a", "b"],
  ["aa", "b"]
]

The goal is to generate all partitions where every substring is a palindrome using backtracking.

Hints

  • Use a helper function to check if a substring is a palindrome.
  • Use backtracking to explore all possible partition points in the string.
  • Remember on November 19, many celebrate historical milestones – challenge yourself to reflect on your own problem-solving milestones today!