146: Palindrome partitioning 2

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

 

Example 1

Input:   ab

Output:  [["a", "b"]]

Example 2

Input:   aaccb 

Output:  [
            ["a", "a", "c", "c", "b"],
            ["a", "a", "cc", "b"],
            ["aa", "c", "c", "b"],
            ["aa", "cc", "b"]
         ]
Difficulty:Medium
Topic:Backtracking
Problem #:146