HARDasked at 2 companies

Maximum Employees to Be Invited to a Meeting

A hard-tier problem at 62% community acceptance, tagged with Depth-First Search, Graph, Topological Sort. Reported in interviews at Barclays and 1 others.

Founder's read

Maximum Employees to Be Invited to a Meeting is a graph problem that looks simple on the surface but trips up candidates who don't see the dual-path pattern hiding in the constraints. You're given a directed graph of employee preferences, and you need to find the maximum number of people who can actually attend a meeting where everyone gets a person they want. Barclays and SAP have both asked this. The 62% acceptance rate tells you it's harder than the median hard problem. If this hits your live assessment and you can't spot the two-cycle plus chain structure, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
2
Difficulty
HARD
Acceptance
62%

Companies that ask "Maximum Employees to Be Invited to a Meeting"

If this hits your live OA

Maximum Employees to Be Invited to a Meeting 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. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The trick is recognizing that valid meeting groups come in exactly two forms: cycles of any length, or a pair of mutually-preferred employees (a 2-cycle) with chains hanging off them. Most candidates jump straight to finding the longest cycle, which misses the second case entirely. You need to run depth-first search to detect cycles, separate them from tree edges, and then calculate both scenarios: the longest single cycle, and the best 2-cycle plus its inbound chains combined. The topological sort framing helps organize the graph traversal, but the real insight is that you're comparing two completely different structures, not optimizing one. Common failure: treating all cycles the same way, or forgetting that chains can branch off the 2-cycle. This is where depth-first search discipline and graph decomposition matter. If you haven't drilled this exact pattern before, StealthCoder is your safety net on test day.

Pattern tags

The honest play

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

Maximum Employees to Be Invited to a Meeting recycles across companies for a reason. It's hard-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. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Maximum Employees to Be Invited to a Meeting interview FAQ

Why is the acceptance rate only 62% if this is asking for graph traversal basics?+

Because the problem hides a second valid structure (2-cycle plus chains) that most candidates miss. They code a longest-cycle finder and submit, missing points. The dual-case logic is the wall, not DFS itself. That's why it's a hard problem with a lower-than-expected pass rate.

Do I need topological sort to solve this?+

Topological sort helps organize your thinking, but depth-first search is your core tool. You're detecting cycles and measuring chain depth, which DFS handles natively. Topological sort is more of a conceptual frame for understanding the acyclic parts than a required algorithm step.

What's the difference between finding one long cycle versus a 2-cycle with chains?+

A long cycle by itself contributes its full length. A 2-cycle contributes 2, but each person in the 2-cycle can have incoming chains from other employees, so you add those depths too. Your final answer is the max of these two scenarios. Missing the second case costs you half the problem.

Is this still asked at SAP and Barclays?+

Yes, both companies have reportedly asked it. The 62% acceptance rate and hard difficulty suggest it's a real filter in their interview loops. It's not a niche problem. Expect it if you have an OA there.

How do I avoid timeout on large graphs?+

Visit each node once during DFS, mark visited state clearly, and compute cycle detection in a single pass. Don't re-traverse the same edges. The constraint is typically under 100K nodes, so single-pass DFS and BFS won't TLE if your visited tracking is clean.

Want the actual problem statement? View "Maximum Employees to Be Invited to a Meeting" 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.