Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitionings of s.
Example 1
Input: s = aab
Output: [["a","a","b"],["aa","b"]]
Explanation: "aab" can be cut into single letters a | a | b, or into aa | b since "aa" is a palindrome. "ab" and "aab" are not palindromes, so there are no other partitions.
Example 2
Input: s = a
Output: [["a"]]
Explanation: The only partition of a single letter is the letter itself.
Example 3
Input: s = aba
Output: [["a","b","a"],["aba"]]
Explanation: "aba" can be cut into a | b | a, or left whole because "aba" is itself a palindrome.
Try every possible first cut. If the prefix s[start..end] is a palindrome, keep it and recursively partition the rest. A full partition is complete when start reaches the end of the string.
Run checks all cases above. Submit evaluates all test cases.