mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 13:06:47 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你二叉树的根结点 <code>root</code> ,请你将它展开为一个单链表:</p>\n\n<ul>\n\t<li>展开后的单链表应该同样使用 <code>TreeNode</code> ,其中 <code>right</code> 子指针指向链表中下一个结点,而左子指针始终为 <code>null</code> 。</li>\n\t<li>展开后的单链表应该与二叉树 <a href=\"https://baike.baidu.com/item/%E5%85%88%E5%BA%8F%E9%81%8D%E5%8E%86/6442839?fr=aladdin\" target=\"_blank\"><strong>先序遍历</strong></a> 顺序相同。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/01/14/flaten.jpg\" style=\"width: 500px; height: 226px;\" />\n<pre>\n<strong>输入:</strong>root = [1,2,5,3,4,null,6]\n<strong>输出:</strong>[1,null,2,null,3,null,4,null,5,null,6]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>root = []\n<strong>输出:</strong>[]\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>root = [0]\n<strong>输出:</strong>[0]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>树中结点数在范围 <code>[0, 2000]</code> 内</li>\n\t<li><code>-100 <= Node.val <= 100</code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong>你可以使用原地算法(<code>O(1)</code> 额外空间)展开这棵树吗?</p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 1117,
|
||||
"likes": 1120,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Flatten a Multilevel Doubly Linked List\", \"titleSlug\": \"flatten-a-multilevel-doubly-linked-list\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6241\\u5e73\\u5316\\u591a\\u7ea7\\u53cc\\u5411\\u94fe\\u8868\"}]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"235K\", \"totalSubmission\": \"322.8K\", \"totalAcceptedRaw\": 235013, \"totalSubmissionRaw\": 322791, \"acRate\": \"72.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"236K\", \"totalSubmission\": \"324.1K\", \"totalAcceptedRaw\": 235976, \"totalSubmissionRaw\": 324131, \"acRate\": \"72.8%\"}",
|
||||
"hints": [
|
||||
"If you notice carefully in the flattened tree, each node's right child points to the next node of a pre-order traversal."
|
||||
],
|
||||
|
Reference in New Issue
Block a user