Palindromic Partitions

Backtracking Palindrome Partitioning Algorithm Easy Medium

Palindromic Partitions

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

Details

  • A palindrome string is a string that reads the same backward as forward.
  • You need to find all combinations of partitions where every substring in each combination is a palindrome.

Example

For example, given the input string "aab":

Possible partitions are:

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

Instructions

Implement a function that takes a string as input and returns a list (or array) of lists (or arrays) of strings, where each inner list represents a valid palindromic partition of the input string. This problem can be naturally solved using a backtracking approach.

Happy coding!

Note: January 16, 2025, is a great day to challenge your problem-solving skills, much like the innovative spirit found in historical breakthroughs on this day!