1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-08 08:51:42 +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>例如,给定如下二叉树: root = [3,5,1,6,2,0,8,null,null,7,4]</p>\n\n<pre> 3\n / \\\n 5 1\n / \\ / \\\n6 2 0 8\n / \\\n 7 4\n</pre>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1\n<strong>输出:</strong> 3\n<strong>解释:</strong> 节点 5 和节点 1 的最近公共祖先是节点 3。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 4\n<strong>输出:</strong> 5\n<strong>解释:</strong> 节点 5 和节点 4 的最近公共祖先是节点 5。因为根据定义最近公共祖先节点可以为节点本身。</pre>\n\n<p><strong>说明:</strong></p>\n\n<pre>所有节点的值都是唯一的。\np、q 为不同节点且均存在于给定的二叉树中。</pre>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 72,
"likes": 74,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -95,7 +95,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"20.8K\", \"totalSubmission\": \"29K\", \"totalAcceptedRaw\": 20757, \"totalSubmissionRaw\": 29003, \"acRate\": \"71.6%\"}",
"stats": "{\"totalAccepted\": \"21.4K\", \"totalSubmission\": \"29.9K\", \"totalAcceptedRaw\": 21420, \"totalSubmissionRaw\": 29947, \"acRate\": \"71.5%\"}",
"hints": [
"小心!你的算法处理只有一个节点的情况吗?会发生什么事?你可能要微调返回值。",
"如果每个节点都有一个到其父节点的链接我们可以利用9.2节问题2.7的方法。然而,面试官可能不会让我们作出这样的假设。",