MEDIUMasked at 5 companies

Managers with at Least 5 Direct Reports

A medium-tier problem at 49% community acceptance, tagged with Database. Reported in interviews at ZS Associates and 4 others.

Founder's read

You're prepping for an OA and see a database problem asking you to find managers with at least 5 direct reports. Meta, Deloitte, ZS Associates, Cognizant, and EPAM Systems have all asked this one. The acceptance rate sits around 49 percent, which means roughly half the candidates who attempt it either misread the schema, botch the join, or write a query that times out on large employee tables. This is a classic trap: the problem looks straightforward until you realize you need to group, count, filter, and often self-join to avoid false negatives. If you blank on the pattern during your live assessment, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
5
Difficulty
MEDIUM
Acceptance
49%

Companies that ask "Managers with at Least 5 Direct Reports"

If this hits your live OA

Managers with at Least 5 Direct Reports is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.

Get StealthCoder
What this means

The trick here is understanding that you can't just filter on a single join. You need to COUNT direct reports per manager, then filter for counts greater than or equal to 5. Most candidates write a basic join and GROUP BY, but they miss edge cases: managers with no reports at all, or managers who are also employees in the same table. The self-join pattern matters because the employee table typically stores both employees and managers in the same rows. Common pitfall: forgetting to use HAVING instead of WHERE to filter grouped counts, or not handling NULL manager IDs correctly. You'll often see candidates write a subquery or CTE to calculate report counts first, then join back to get manager names or IDs. The problem forces you to think about table structure and aggregation logic before you query. StealthCoder hedge: if you freeze on the schema or the join order during your OA, you get a tested query that handles the edge cases and passes in one submission.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Managers with at Least 5 Direct Reports recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Managers with at Least 5 Direct Reports interview FAQ

Is this problem actually asked at big tech, or just consulting firms?+

Both. Meta is on the list alongside consulting shops like Deloitte and ZS Associates. It's a database fundamentals problem that tech companies use to screen SQL skills, especially for data and analytics roles. Roughly half of candidates pass it, so it's positioned as a genuine gatekeeper, not a gimme.

What's the main trick I need to know before I sit down?+

Use GROUP BY with HAVING to filter aggregates, not WHERE. Count direct reports per manager ID, then filter for counts >= 5. If the table structure isn't clear in the problem statement, assume a self-referential employee table with a manager_id foreign key pointing back to the same table.

What if I get this problem live and I'm not sure about the table structure?+

Read the problem statement carefully for the schema. If it's ambiguous, ask in the chat or write a quick SELECT to inspect the first few rows. You're allowed to do that. If you freeze and can't remember the join pattern, StealthCoder runs invisibly and shows you a solution that works on the platform you're using.

How does this relate to other database problems I should know?+

It combines self-joins, GROUP BY, HAVING, and COUNT. Master those skills and you'll handle hierarchical queries, org charts, and other aggregation problems. It's foundational for any database screening, not a one-off pattern.

Is 49 percent acceptance rate high or low?+

It's medium. Most easy problems sit above 70 percent, hard ones below 30 percent. A 49 percent acceptance rate means this problem punishes syntax errors, schema misunderstandings, and off-by-one logic. It's harder than it looks on first read.

Want the actual problem statement? View "Managers with at Least 5 Direct Reports" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.