【leetcode】132. Palindrome Partitioning II

题目如下: 解题思路:本题是【leetcode】131. Palindrome Partitioning的升级版,要求的是求出最小cuts,如果用【leetcode】131. Palindrome Partitioning的方法把所有解的都求出来取最小值肯定会超时。对于求最大/最小值的题目,大多数情况下都是用动态规划的方法。首先创建dp数组,其长度等于输入字符串s的长度+1,dp[i]表示s[0:
相关文章
相关标签/搜索