问题描述:
https://oj.leetcode.com/problems/palindrome-partitioning-ii/点击打开链接
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
For example, given s = "aab",
Return 1 since the palindrome partitioning ["aa","b"] could be produced using 1 cut.
问题分析:
定义:
f[i] : 字符串s[1, i]的最小cut。
初始化:
f[i] = i - 1; 最差情况分割成为独立的字符。
推导:
f[i] = min{ f[i], f[j-1] + 1} s[j, i]是回文串。