Reported June 2026
Expediabinary search

Maximum Team Size

Reported by candidates from Expedia's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Expedia OA. Under 2s to a working solution.
Founder's read

The Expedia OA reported in June 2026 hides a trap in the phrase "at least one employee can interact with all others." Most people reach for max overlap at a single point, and that gives the wrong answer. This is an interval problem with a hub employee: pick one interval, count how many others overlap it, and take the best. Sort, count, done. If you blank on the counting step during the live assessment, StealthCoder runs invisibly on your desktop and hands you the working solution while the proctor sees nothing.

The problem

Given n employees, the time when the jth employee starts working is represented by the array startTime[j], and the time when they finish the work is represented by the array endTime[j].
The ith employee can interact with the jth employee if their working hours overlap. A team can only be formed if at least one employee of the team can interact with all other team members.
Determine the maximum size of such a team.

Function
getMaximumTeamSize(startTime: int[], endTime: int[]) → int
Complete the function getMaximumTeamSize in the editor with the following parameters:
int startTime[n]: the start times of employees' work
int endTime[n]: the end times of employees' work
Returns
int: the maximum possible team size

Examples
Example 1
startTime = [1, 6, 4, 3, 1]
endTime = [2, 7, 5, 8, 2]
return = 3
For this example, n = 5. The source image illustrates the working intervals as follows:
Employees12345678
4o---->o
3o-------------->o
2o---->o
1o---->o
0o---->o
Working Hours
Consider the group [1, 2, 3]. Employee 3 can interact with other employees in the group, so a team of size 3 is possible.
A team with more than 3 employees is impossible. Therefore, the answer is 3.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick: the team needs one hub whose interval overlaps every other member. So for each employee i, count the intervals j that overlap it, then add 1 for the hub itself. The answer is the max over all i. Two intervals overlap when start_j <= end_i and end_j >= start_i. Brute force is O(n^2) and may time out on big inputs. The faster way is to count non-overlapping intervals instead. Sort all starts and all ends separately. For interval i, the ones that miss it either end before start_i or start after end_i. Binary search both sorted arrays, subtract from n. That's O(n log n). The edge case that breaks naive solutions is the boundary: do touching intervals like [1,2] and [2,3] overlap? Check the examples and be consistent with the comparison operator. Also don't confuse this with max simultaneous overlap. If you freeze on the binary search counting during the live OA, StealthCoder is the hedge.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Maximum 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. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Expedia's OA.

Expedia reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Maximum Team Size FAQ

What's the trick in Maximum Team Size?+

Treat each employee as a possible hub. Count how many other intervals overlap the hub, add one, and take the max across all hubs. You don't need every team member to overlap each other, only the hub with everyone else.

Why doesn't max overlap at a single time point work?+

A hub can overlap two employees who never overlap each other, like one long shift covering two short separate ones. Point overlap would count only one of them. The hub rule allows both, so the answer can be larger.

What complexity do I need?+

Brute force O(n^2) is correct but risky for large n. Aim for O(n log n): sort starts and ends separately, then binary search to count intervals that end before or start after each hub. Subtract those from n.

How do I handle touching intervals?+

Decide from the problem's wording and the example whether a shared endpoint counts as overlap. The condition start_j <= end_i and end_j >= start_i treats touching as overlap. Test it against the example before you submit.

How do I prepare for this in 48 hours?+

Practice interval overlap counting and the complement trick with sorted arrays and binary search. Write the brute force first, then optimize. Run the sample, then test edge cases like one employee, identical intervals, and fully nested intervals.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Expedia.

OA at Expedia?
Invisible during screen share
Get it