1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-21 21:16:45 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 16:56:27 +08:00
parent e730aa6794
commit ad15da05aa
2517 changed files with 7358 additions and 7332 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你二叉树的根节点&nbsp;<code>root</code> 和一个表示目标和的整数&nbsp;<code>targetSum</code> 。判断该树中是否存在 <strong>根节点到叶子节点</strong> 的路径,这条路径上所有节点值相加等于目标和&nbsp;<code>targetSum</code> 。如果存在,返回 <code>true</code> ;否则,返回 <code>false</code> 。</p>\n\n<p><strong>叶子节点</strong> 是指没有子节点的节点。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/01/18/pathsum1.jpg\" style=\"width: 500px; height: 356px;\" />\n<pre>\n<strong>输入:</strong>root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22\n<strong>输出:</strong>true\n<strong>解释:</strong>等于目标和的根节点到叶节点路径如上图所示。\n</pre>\n\n<p><strong>示例 2</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/01/18/pathsum2.jpg\" />\n<pre>\n<strong>输入:</strong>root = [1,2,3], targetSum = 5\n<strong>输出:</strong>false\n<strong>解释:</strong>树中存在两条根节点到叶子节点的路径:\n(1 --&gt; 2): 和为 3\n(1 --&gt; 3): 和为 4\n不存在 sum = 5 的根节点到叶子节点的路径。</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>root = [], targetSum = 0\n<strong>输出:</strong>false\n<strong>解释:</strong>由于树是空的,所以不存在根节点到叶子节点的路径。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>树中节点的数目在范围 <code>[0, 5000]</code> 内</li>\n\t<li><code>-1000 &lt;= Node.val &lt;= 1000</code></li>\n\t<li><code>-1000 &lt;= targetSum &lt;= 1000</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 829,
"likes": 833,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Path Sum II\", \"titleSlug\": \"path-sum-ii\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u8def\\u5f84\\u603b\\u548c II\"}, {\"title\": \"Binary Tree Maximum Path Sum\", \"titleSlug\": \"binary-tree-maximum-path-sum\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u4e8c\\u53c9\\u6811\\u4e2d\\u7684\\u6700\\u5927\\u8def\\u5f84\\u548c\"}, {\"title\": \"Sum Root to Leaf Numbers\", \"titleSlug\": \"sum-root-to-leaf-numbers\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6c42\\u6839\\u8282\\u70b9\\u5230\\u53f6\\u8282\\u70b9\\u6570\\u5b57\\u4e4b\\u548c\"}, {\"title\": \"Path Sum III\", \"titleSlug\": \"path-sum-iii\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u8def\\u5f84\\u603b\\u548c III\"}, {\"title\": \"Path Sum IV\", \"titleSlug\": \"path-sum-iv\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u8def\\u5f84\\u603b\\u548c IV\"}]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"353.8K\", \"totalSubmission\": \"666.3K\", \"totalAcceptedRaw\": 353815, \"totalSubmissionRaw\": 666341, \"acRate\": \"53.1%\"}",
"stats": "{\"totalAccepted\": \"355.3K\", \"totalSubmission\": \"669K\", \"totalAcceptedRaw\": 355332, \"totalSubmissionRaw\": 669045, \"acRate\": \"53.1%\"}",
"hints": [],
"solution": null,
"status": null,