mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-25 06:48:57 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个头结点为 <code>head</code> 的单链表和一个整数 <code>k</code> ,请你设计一个算法将链表分隔为 <code>k</code> 个连续的部分。</p>\n\n<p>每部分的长度应该尽可能的相等:任意两部分的长度差距不能超过 1 。这可能会导致有些部分为 null 。</p>\n\n<p>这 <code>k</code> 个部分应该按照在链表中出现的顺序排列,并且排在前面的部分的长度应该大于或等于排在后面的长度。</p>\n\n<p>返回一个由上述 <code>k</code> 部分组成的数组。</p>\n \n\n<p><strong>示例 1:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/06/13/split1-lc.jpg\" style=\"width: 400px; height: 134px;\" />\n<pre>\n<strong>输入:</strong>head = [1,2,3], k = 5\n<strong>输出:</strong>[[1],[2],[3],[],[]]\n<strong>解释:</strong>\n第一个元素 output[0] 为 output[0].val = 1 ,output[0].next = null 。\n最后一个元素 output[4] 为 null ,但它作为 ListNode 的字符串表示是 [] 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/06/13/split2-lc.jpg\" style=\"width: 600px; height: 60px;\" />\n<pre>\n<strong>输入:</strong>head = [1,2,3,4,5,6,7,8,9,10], k = 3\n<strong>输出:</strong>[[1,2,3,4],[5,6,7],[8,9,10]]\n<strong>解释:</strong>\n输入被分成了几个连续的部分,并且每部分的长度相差不超过 1 。前面部分的长度大于等于后面部分的长度。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>链表中节点的数目在范围 <code>[0, 1000]</code></li>\n\t<li><code>0 <= Node.val <= 1000</code></li>\n\t<li><code>1 <= k <= 50</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 251,
|
||||
"likes": 252,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Rotate List\", \"titleSlug\": \"rotate-list\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u65cb\\u8f6c\\u94fe\\u8868\"}, {\"title\": \"Odd Even Linked List\", \"titleSlug\": \"odd-even-linked-list\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u5947\\u5076\\u94fe\\u8868\"}]",
|
||||
@@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"52.8K\", \"totalSubmission\": \"86.9K\", \"totalAcceptedRaw\": 52768, \"totalSubmissionRaw\": 86891, \"acRate\": \"60.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"53.5K\", \"totalSubmission\": \"88.1K\", \"totalAcceptedRaw\": 53461, \"totalSubmissionRaw\": 88146, \"acRate\": \"60.7%\"}",
|
||||
"hints": [
|
||||
"If there are N nodes in the list, and k parts, then every part has N/k elements, except the first N%k parts have an extra one."
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user