LeetCode – Palindrome Partitioning (Java)

Problem 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”] ] 1. Depth-first Search public ArrayList<ArrayList<String>> partition(String s) { ArrayList<ArrayList<String>> result = new ArrayList<ArrayList<String>>();   if (s == null || s.length() … Read more