mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-23 05:48:57 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个链表的头节点 <code>head</code> ,该链表包含由 <code>0</code> 分隔开的一连串整数。链表的 <strong>开端</strong> 和 <strong>末尾</strong> 的节点都满足 <code>Node.val == 0</code> 。</p>\n\n<p>对于每两个相邻的 <code>0</code> ,请你将它们之间的所有节点合并成一个节点,其值是所有已合并节点的值之和。然后将所有 <code>0</code> 移除,修改后的链表不应该含有任何 <code>0</code> 。</p>\n\n<p> 返回修改后链表的头节点 <code>head</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:<br />\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2022/02/02/ex1-1.png\" style=\"width: 600px; height: 41px;\" /></strong></p>\n\n<pre>\n<strong>输入:</strong>head = [0,3,1,0,4,5,2,0]\n<strong>输出:</strong>[4,11]\n<strong>解释:</strong>\n上图表示输入的链表。修改后的链表包含:\n- 标记为绿色的节点之和:3 + 1 = 4\n- 标记为红色的节点之和:4 + 5 + 2 = 11\n</pre>\n\n<p><strong>示例 2:<br />\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2022/02/02/ex2-1.png\" style=\"width: 600px; height: 41px;\" /></strong></p>\n\n<pre>\n<strong>输入:</strong>head = [0,1,0,3,0,2,2,0]\n<strong>输出:</strong>[1,3,4]\n<strong>解释:</strong>\n上图表示输入的链表。修改后的链表包含:\n- 标记为绿色的节点之和:1 = 1\n- 标记为红色的节点之和:3 = 3\n- 标记为黄色的节点之和:2 + 2 = 4\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>列表中的节点数目在范围 <code>[3, 2 * 10<sup>5</sup>]</code> 内</li>\n\t<li><code>0 <= Node.val <= 1000</code></li>\n\t<li><strong>不</strong> 存在连续两个 <code>Node.val == 0</code> 的节点</li>\n\t<li>链表的 <strong>开端</strong> 和 <strong>末尾</strong> 节点都满足 <code>Node.val == 0</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 7,
|
||||
"likes": 9,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.2K\", \"totalSubmission\": \"9.5K\", \"totalAcceptedRaw\": 8213, \"totalSubmissionRaw\": 9471, \"acRate\": \"86.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"8.9K\", \"totalSubmission\": \"10.3K\", \"totalAcceptedRaw\": 8871, \"totalSubmissionRaw\": 10270, \"acRate\": \"86.4%\"}",
|
||||
"hints": [
|
||||
"How can you use two pointers to modify the original list into the new list?",
|
||||
"Have a pointer traverse the entire linked list, while another pointer looks at a node that is currently being modified.",
|
||||
|
Reference in New Issue
Block a user