Maximum Interactive Team Size
Reported by candidates from Microsoft's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The mistake that sinks a first attempt on this Microsoft OA, reported in October 2026, is assuming the team needs a shared moment in time. It doesn't. Only one center employee has to overlap everyone else, and the others can be strangers to each other. That makes it a counting problem over intervals, not a max-overlap sweep. With n up to 200000, brute force dies fast. If you blank on the counting trick mid-assessment, StealthCoder is the invisible overlay that reads the problem and hands you the approach, so one lost idea doesn't end the attempt.
The problem
You are given n employees. Employee i works during the closed interval [startTime[i], endTime[i]]. Two employees can interact when their working intervals overlap. A team is valid when at least one employee in that team can interact with every other team member. The other team members do not need to interact with one another. Return the maximum possible size of a valid team. An employee is included in their own team, so the answer is at least 1. Function getMaximumTeamSize(startTime: int[], endTime: int[]) → int Examples Example 1 startTime = [1,6,4,3,1] endTime = [2,7,5,8,2] return = 3 Employees 1, 2, and 3 form a valid team because employee 3, working from 3 through 8, overlaps both other intervals. No employee overlaps enough intervals to form a team of four. Example 2 startTime = [1,2,3] endTime = [5,4,3] return = 3 All three intervals contain time 3, so any employee can serve as the member who interacts with everyone. Example 3 startTime = [1,4,7] endTime = [2,5,8] return = 1 No two employees overlap, so every valid team contains only its central employee. Constraints 1 <= startTime.length == endTime.length <= 200000. 0 <= startTime[i] <= endTime[i] <= 10^9. Intervals that share an endpoint overlap.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Pick each employee as the center. The team size is 1 plus the number of other intervals that overlap that employee's interval. Two closed intervals overlap unless one ends before the other starts. So count the non-overlapping ones instead. For interval i, intervals entirely left have end < start[i]. Intervals entirely right have start > end[i]. These two groups are disjoint, since start <= end for every interval. Sort all end times and all start times. Binary search each to count them. The answer is the max over i of n - leftCount - rightCount. Shared endpoints count as overlap, so use strict inequalities for the non-overlap counts. The pitfall is running a sweep line for max simultaneous overlap, which gives 2 on example 1 instead of 3. Total cost is O(n log n). If the logic slips under pressure, StealthCoder is your hedge during the live OA.
Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.
You can drill Maximum Interactive Team Size cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Microsoft's OA.
Microsoft reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Maximum Interactive Team Size FAQ
What's the trick in Maximum Interactive Team Size?+
Treat each employee as the center and count how many intervals overlap it. Count the non-overlapping ones instead: those ending before its start or starting after its end. Subtract both from n. The best center gives the answer. Sorting plus binary search makes it fast enough.
Why doesn't a standard max-overlap sweep work here?+
A sweep finds the most intervals sharing one point in time. This problem only needs one center overlapping everyone else, and the others can miss each other. Example 1 shows it: the sweep gives 2, but the answer is 3.
How hard is this one really?+
Medium. The code is short, but the reframe is the hard part. Once you see non-overlap is just two counts, it's two sorted arrays and binary search. Most failures come from misreading the team rule, not from implementation.
How do I handle shared endpoints?+
They count as overlap, so intervals touching at a point interact. Count left-side non-overlap as end < start[i] and right-side as start > end[i], both strict. Using <= would wrongly drop touching intervals and undercount the team.
How do I prepare for this in 48 hours?+
Practice interval overlap problems where you count the complement instead of the overlap directly. Write the sorted-array plus bisect pattern until it's automatic. Test edge cases: all identical intervals, a single employee, and fully disjoint intervals like example 3.