1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 14:12:17 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个由小写字母组成的字符串&nbsp;<code>s</code>,和一个整数&nbsp;<code>k</code>。</p>\n\n<p>请你按下面的要求分割字符串:</p>\n\n<ul>\n\t<li>首先,你可以将&nbsp;<code>s</code>&nbsp;中的部分字符修改为其他的小写英文字母。</li>\n\t<li>接着,你需要把&nbsp;<code>s</code>&nbsp;分割成&nbsp;<code>k</code>&nbsp;个非空且不相交的子串,并且每个子串都是回文串。</li>\n</ul>\n\n<p>请返回以这种方式分割字符串所需修改的最少字符数。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>s = &quot;abc&quot;, k = 2\n<strong>输出:</strong>1\n<strong>解释:</strong>你可以把字符串分割成 &quot;ab&quot; 和 &quot;c&quot;,并修改 &quot;ab&quot; 中的 1 个字符,将它变成回文串。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>s = &quot;aabbc&quot;, k = 3\n<strong>输出:</strong>0\n<strong>解释:</strong>你可以把字符串分割成 &quot;aa&quot;、&quot;bb&quot; 和 &quot;c&quot;,它们都是回文串。</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><strong>输入:</strong>s = &quot;leetcode&quot;, k = 8\n<strong>输出:</strong>0\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= k &lt;= s.length &lt;= 100</code></li>\n\t<li><code>s</code>&nbsp;中只含有小写英文字母。</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 96,
"likes": 101,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"4.4K\", \"totalSubmission\": \"7.1K\", \"totalAcceptedRaw\": 4359, \"totalSubmissionRaw\": 7144, \"acRate\": \"61.0%\"}",
"stats": "{\"totalAccepted\": \"4.5K\", \"totalSubmission\": \"7.4K\", \"totalAcceptedRaw\": 4498, \"totalSubmissionRaw\": 7382, \"acRate\": \"60.9%\"}",
"hints": [
"For each substring calculate the minimum number of steps to make it palindrome and store it in a table.",
"Create a dp(pos, cnt) which means the minimum number of characters changed for the suffix of s starting on pos splitting the suffix on cnt chunks."