Question:
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 s = "aab",
Return
[
["aa","b"],
["a","a","b"]
]
public class Solution {
public ArrayList
> partition(String s) {
ArrayList
> results = new ArrayList<>(); ArrayList
result = new ArrayList<>(); dfs(s,0,result,results); return results; } private void dfs(String s, int step, ArrayList
result, ArrayList
> results) { if(step==s.length()){ results.add(new ArrayList
(result)); } for(int i=step;i