mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 07:51:41 +08:00
存量题库数据更新
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
| id | int |
|
||||
| p_id | int |
|
||||
+-------------+------+
|
||||
id is the primary key column for this table.
|
||||
id is the column with unique values for this table.
|
||||
Each row of this table contains information about the id of a node and the id of its parent node in a tree.
|
||||
The given structure is always a valid tree.
|
||||
</pre>
|
||||
@@ -22,14 +22,14 @@ The given structure is always a valid tree.
|
||||
<li><strong>"Inner"</strong>: If the node is neither a leaf node nor a root node.</li>
|
||||
</ul>
|
||||
|
||||
<p>Write an SQL query to report the type of each node in the tree.</p>
|
||||
<p>Write a solution to report the type of each node in the tree.</p>
|
||||
|
||||
<p>Return the result table <strong>ordered</strong> by <code>id</code> <strong>in ascending order</strong>.</p>
|
||||
<p>Return the result table in <strong>any order</strong>.</p>
|
||||
|
||||
<p>The query result format is in the following example.</p>
|
||||
<p>The result format is in the following example.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2021/10/22/tree1.jpg" style="width: 304px; height: 224px;" />
|
||||
<pre>
|
||||
<strong>Input:</strong>
|
||||
@@ -59,7 +59,7 @@ Node 2 is an inner node because it has parent node 1 and child node 4 and 5.
|
||||
Nodes 3, 4, and 5 are leaf nodes because they have parent nodes and they do not have child nodes.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2021/10/22/tree2.jpg" style="width: 64px; height: 65px;" />
|
||||
<pre>
|
||||
<strong>Input:</strong>
|
||||
|
Reference in New Issue
Block a user