Closed
Description
The generation result of 1123. Lowest Common Ancestor of Deepest Leaves is found to have extra <
and >
wrapped around a hyperlink.
Here is the link to generation result:
https://t.me/LeetcodeQustionOfToday/1235
The full JSON response body of API:
{
"data": {
"activeDailyCodingChallengeQuestion": {
"link": "/problems/lowest-common-ancestor-of-deepest-leaves/",
"date": "2025-04-04",
"question": {
"questionFrontendId": "1123",
"title": "Lowest Common Ancestor of Deepest Leaves",
"titleSlug": "lowest-common-ancestor-of-deepest-leaves",
"content": "<p>Given the <code>root</code> of a binary tree, return <em>the lowest common ancestor of its deepest leaves</em>.</p>\n\n<p>Recall that:</p>\n\n<ul>\n\t<li>The node of a binary tree is a leaf if and only if it has no children</li>\n\t<li>The depth of the root of the tree is <code>0</code>. if the depth of a node is <code>d</code>, the depth of each of its children is <code>d + 1</code>.</li>\n\t<li>The lowest common ancestor of a set <code>S</code> of nodes, is the node <code>A</code> with the largest depth such that every node in <code>S</code> is in the subtree with root <code>A</code>.</li>\n</ul>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n<img alt=\"\" src=\"https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/01/sketch1.png\" style=\"width: 600px; height: 510px;\" />\n<pre>\n<strong>Input:</strong> root = [3,5,1,6,2,0,8,null,null,7,4]\n<strong>Output:</strong> [2,7,4]\n<strong>Explanation:</strong> We return the node with value 2, colored in yellow in the diagram.\nThe nodes coloured in blue are the deepest leaf-nodes of the tree.\nNote that nodes 6, 0, and 8 are also leaf nodes, but the depth of them is 2, but the depth of nodes 7 and 4 is 3.</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> root = [1]\n<strong>Output:</strong> [1]\n<strong>Explanation:</strong> The root is the deepest node in the tree, and it's the lca of itself.\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> root = [0,1,3,null,2]\n<strong>Output:</strong> [2]\n<strong>Explanation:</strong> The deepest leaf node in the tree is 2, the lca of one node is itself.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li>The number of nodes in the tree will be in the range <code>[1, 1000]</code>.</li>\n\t<li><code>0 <= Node.val <= 1000</code></li>\n\t<li>The values of the nodes in the tree are <strong>unique</strong>.</li>\n</ul>\n\n<p> </p>\n<p><strong>Note:</strong> This question is the same as 865: <a href=\"https://leetcode.com/problems/smallest-subtree-with-all-the-deepest-nodes/\" target=\"_blank\">https://leetcode.com/problems/smallest-subtree-with-all-the-deepest-nodes/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"topicTags": [
{
"name": "Hash Table",
"slug": "hash-table"
},
{
"name": "Tree",
"slug": "tree"
},
{
"name": "Depth-First Search",
"slug": "depth-first-search"
},
{
"name": "Breadth-First Search",
"slug": "breadth-first-search"
},
{
"name": "Binary Tree",
"slug": "binary-tree"
}
],
"stats": "{\"totalAccepted\": \"140.5K\", \"totalSubmission\": \"189.2K\", \"totalAcceptedRaw\": 140541, \"totalSubmissionRaw\": 189232, \"acRate\": \"74.3%\"}",
"hints": [
"Do a postorder traversal.",
"Then, if both subtrees contain a deepest leaf, you can mark this node as the answer (so far).",
"The final node marked will be the correct answer."
]
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels