Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.
Input: s = "aab"
Output: [["a","a","b"],["aa","b"]]
Topics: backtracking, dp
Asked by: Amazon, Google, Meta, Microsoft, Bloomberg
Time complexity: O(n × 2^n). Space complexity: O(n²).