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-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>最大树定义:一个树,其中每个节点的值都大于其子树中的任何其他值。</p>\n\n<p>给出最大树的根节点 <code>root</code>。</p>\n\n<p>就像<a href=\"https://leetcode-cn.com/problems/maximum-binary-tree/\">之前的问题</a>那样,给定的树是从列表 <code>A</code><code>root = Construct(A)</code>)递归地使用下述 <code>Construct(A)</code> 例程构造的:</p>\n\n<ul>\n\t<li>如果 <code>A</code> 为空,返回 <code>null</code></li>\n\t<li>否则,令 <code>A[i]</code> 作为 A 的最大元素。创建一个值为 <code>A[i]</code> 的根节点 <code>root</code></li>\n\t<li><code>root</code> 的左子树将被构建为 <code>Construct([A[0], A[1], ..., A[i-1]])</code></li>\n\t<li><code>root</code> 的右子树将被构建为 <code>Construct([A[i+1], A[i+2], ..., A[A.length - 1]])</code></li>\n\t<li>返回 <code>root</code></li>\n</ul>\n\n<p>请注意我们没有直接给定 A只有一个根节点 <code>root = Construct(A)</code>.</p>\n\n<p>假设 <code>B</code> 是 <code>A</code> 的副本,并在末尾附加值 <code>val</code>。题目数据保证 <code>B</code> 中的值是不同的。</p>\n\n<p>返回 <code>Construct(B)</code>。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<p><strong><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/02/23/maximum-binary-tree-1-1.png\" style=\"height: 160px; width: 159px;\" /><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/02/23/maximum-binary-tree-1-2.png\" style=\"height: 160px; width: 169px;\" /></strong></p>\n\n<pre>\n<strong>输入:</strong>root = [4,1,3,null,null,2], val = 5\n<strong>输出:</strong>[5,4,null,1,3,null,null,2]\n<strong>解释:</strong>A = [1,4,2,3], B = [1,4,2,3,5]\n</pre>\n\n<p><strong>示例 2<br />\n<img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/02/23/maximum-binary-tree-2-1.png\" style=\"height: 160px; width: 180px;\" /><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/02/23/maximum-binary-tree-2-2.png\" style=\"height: 160px; width: 214px;\" /></strong></p>\n\n<pre>\n<strong>输入:</strong>root = [5,2,4,null,1], val = 3\n<strong>输出:</strong>[5,2,4,null,1,null,3]\n<strong>解释:</strong>A = [2,1,5,4], B = [2,1,5,4,3]\n</pre>\n\n<p><strong>示例 3<br />\n<img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/02/23/maximum-binary-tree-3-1.png\" style=\"height: 160px; width: 180px;\" /><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/02/23/maximum-binary-tree-3-2.png\" style=\"height: 160px; width: 201px;\" /></strong></p>\n\n<pre>\n<strong>输入:</strong>root = [5,2,3,null,1], val = 4\n<strong>输出:</strong>[5,2,4,null,1,3]\n<strong>解释:</strong>A = [2,1,5,3], B = [2,1,5,3,4]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= B.length <= 100</code></li>\n</ul>\n\n<p> </p>\n\n<p> </p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 55,
"likes": 57,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Maximum Binary Tree\", \"titleSlug\": \"maximum-binary-tree\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6700\\u5927\\u4e8c\\u53c9\\u6811\"}]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"8.6K\", \"totalSubmission\": \"13.9K\", \"totalAcceptedRaw\": 8595, \"totalSubmissionRaw\": 13855, \"acRate\": \"62.0%\"}",
"stats": "{\"totalAccepted\": \"8.8K\", \"totalSubmission\": \"14.1K\", \"totalAcceptedRaw\": 8750, \"totalSubmissionRaw\": 14074, \"acRate\": \"62.2%\"}",
"hints": [],
"solution": null,
"status": null,