Practice Managers with at Least 5 Direct Reports
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Tables: Employee(id INT, name VARCHAR, department VARCHAR, managerId INT). Employee.id is unique. A null managerId means no manager; employees never manage themselves. Return the name of each manager with at least five direct reports. Count rows whose managerId equals that manager's id; indirect reports do not count. Output order is unrestricted.
Source: Managers with at Least 5 Direct Reports on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Employee table: +-----+-------+------------+-----------+ | 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 | +-----+-------+------------+-----------+
+------+ | name | +------+ | John | +------+
Related LeetCode Problems
Practice more problems similar to Managers with at Least 5 Direct Reports.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.