mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-07 08:21:41 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一棵二叉树的根 <code>root</code>,请你考虑它所有 <strong>从根到叶的路径</strong>:从根到任何叶的路径。(所谓一个叶子节点,就是一个没有子节点的节点)</p>\n\n<p>假如通过节点 <code>node</code> 的每种可能的 “根-叶” 路径上值的总和全都小于给定的 <code>limit</code>,则该节点被称之为「不足节点」,需要被删除。</p>\n\n<p>请你删除所有不足节点,并返回生成的二叉树的根。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/06/08/insufficient-1.png\" style=\"height: 200px; width: 482px;\">\n输入:</strong>root = [1,2,3,4,-99,-99,7,8,9,-99,-99,12,13,-99,14], limit = 1\n<strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/06/08/insufficient-2.png\" style=\"height: 200px; width: 258px;\">\n输出:</strong>[1,2,3,4,null,null,7,8,9,null,14]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/06/08/insufficient-3.png\" style=\"height: 200px; width: 292px;\">\n输入:</strong>root = [5,4,8,11,null,17,4,7,1,null,null,5,3], limit = 22\n<strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/06/08/insufficient-4.png\" style=\"height: 200px; width: 264px;\">\n输出:</strong>[5,4,8,11,null,17,4,7,null,null,null,5]</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/06/08/insufficient-5.png\" style=\"height: 100px; width: 140px;\">\n输入:</strong>root = [5,-6,-6], limit = 0<strong>\n输出:</strong>[]</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ol>\n\t<li>给定的树有 <code>1</code> 到 <code>5000</code> 个节点</li>\n\t<li><code>-10^5 <= node.val <= 10^5</code></li>\n\t<li><code>-10^9 <= limit <= 10^9</code></li>\n</ol>\n\n<p> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 54,
|
||||
"likes": 57,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5.2K\", \"totalSubmission\": \"10.3K\", \"totalAcceptedRaw\": 5191, \"totalSubmissionRaw\": 10328, \"acRate\": \"50.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.4K\", \"totalSubmission\": \"10.7K\", \"totalAcceptedRaw\": 5399, \"totalSubmissionRaw\": 10721, \"acRate\": \"50.4%\"}",
|
||||
"hints": [
|
||||
"Consider a DFS traversal of the tree. You can keep track of the current path sum from root to this node, and you can also use DFS to return the minimum value of any path from this node to the leaf. This will tell you if this node is insufficient."
|
||||
],
|
||||
|
Reference in New Issue
Block a user