Skip to main content
All Questions

Add the maximum number of edges so no employee connects to more than max_connections special employees.

Unlock detailed company stats for this questionUpgrade

There are employee_nodes employees; k special employees share mobile hotspots over given bidirectional connections, so all employees connected to a special employee use that hotspot. Any employee may connect to at most max_connections special employees. Return the maximum number of edges that can be added to the graph (no self-loops or multiple edges; no two special employees are connected) such that the constraint holds. Complete getMaximumEdges(employee_nodes, employee_from[], employee_to[], special_employees[], max_connections). Example: 4 employees, edge 1-2, special {1,3}, max_connections=1 -> answer 2 (employee 4 can connect to 1 and 2).

Format · Microsoft SDE-2 round 2 DSA.

Community answers

No answers contributed by the community yet.

Related courses

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.

Course

System Design Interviews

Learn how to answer the latest system design questions across product, infrastructure, and AI domains. Features in-depth video examples, written breakdowns, and helpful reference patterns. Watch senior engineers and managers answer these questions in mock interview videos.