package leetcode;

/**
 * https://leetcode.com/problems/palindrome-partitioning-ii/
 */
public class Problem132 {
    public int minCut(String s) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem132 prob = new Problem132();
        System.out.println(prob.minCut("aab")); // 1
        System.out.println(prob.minCut("aaa")); // 0
        System.out.println(prob.minCut("bbaaaaabb")); // 0
        System.out.println(prob.minCut("baaaaabb")); // 1
    }
}

@@ -153,32 +153,685 @@
     
-// TODO%0A        return 0
+return minCut(s, 0, 1, s.length());%0A    %7D%0A%0A    private static int minCut(String s, int i, int j, int max) %7B%0A        if (i == s.length() %7C%7C j == s.length()) %7B%0A            return max;%0A        %7D%0A        String sub = s.substring(i, j);%0A        int min = max;%0A        if (isPalindrome(sub)) %7B%0A            min = Math.min(min, minCut(s, j, j + 1, max) - 1);%0A        %7D%0A        min = Math.min(min, minCut(s, i, j + 1, max));%0A        return min;%0A    %7D%0A%0A    private static boolean isPalindrome(String s) %7B%0A        for (int i = 0, j = s.length() - 1; i %3C j; i++, j--) %7B%0A            if (s.charAt(i) != s.charAt(j)) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return true
 ;%0A  

Update problem 132