1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-27 02:30:28 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/至少有5名直接下属的经理 [managers-with-at-least-5-direct-reports].html

49 lines
1.3 KiB
HTML
Raw Normal View History

2023-12-09 18:53:53 +08:00
<p>表:&nbsp;<code>Employee</code></p>
<pre>
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| name | varchar |
| department | varchar |
| managerId | int |
+-------------+---------+
id 是此表的主键(具有唯一值的列)。
该表的每一行表示雇员的名字、他们的部门和他们的经理的id。
如果managerId为空则该员工没有经理。
没有员工会成为自己的管理者。
</pre>
<p>&nbsp;</p>
<p>编写一个解决方案,找出至少有<strong>五个直接下属</strong>的经理。</p>
<p><strong>任意顺序 </strong>返回结果表。</p>
<p>查询结果格式如下所示。</p>
<p>&nbsp;</p>
<p><strong>示例 1:</strong></p>
<pre>
<strong>输入:</strong>
Employee 表:
+-----+-------+------------+-----------+
| id | name | department | managerId |
+-----+-------+------------+-----------+
| 101 | John | A | Null |
| 102 | Dan | A | 101 |
| 103 | James | A | 101 |
| 104 | Amy | A | 101 |
| 105 | Anne | A | 101 |
| 106 | Ron | B | 101 |
+-----+-------+------------+-----------+
<strong>输出:</strong>
+------+
| name |
+------+
| John |
+------+</pre>