Maximum Interactive Team Size
Updated
Problem statement
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[]) → intExamples
Example 1
startTime = [1,6,4,3,1]endTime = [2,7,5,8,2]return = 3Employees 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 = 3All 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 = 1No two employees overlap, so every valid team contains only its central employee.
Example 4
startTime = [2,5,6,8]endTime = [5,6,10,9]return = 3Employee 1 works from 5 to 6. It shares time 5 with employee 0 and time 6 with employee 2, so employees 0, 1, and 2 form a valid team. No employee overlaps all three of the others, so the answer is 3.
Example 5
startTime = [1,2,8,8,10]endTime = [4,8,12,9,11]return = 4Employee 1 works from 2 to 8 and overlaps employees 0, 2, and 3; it meets the last two only at time 8. That makes a valid team of four. No employee overlaps all four of the others, so five is not possible.
Constraints
1 <= startTime.length == endTime.length <= 200000.0 <= startTime[i] <= endTime[i] <= 10^9.- Intervals that share an endpoint overlap.
More Microsoft Online Assessment questions
- Authentication SystemOA · Seen Nov 2026
- Maximum String OperationsOA · Seen Nov 2026
- Minimum Cost to Process Priority TasksOA · Seen Nov 2026
- Most Visited Sprint MarkerOA · Seen Nov 2026
- Maximum Escape Game ScoreOA · Seen Nov 2026
- Count Subarrays with a Perfect-Square ProductOA · Seen Nov 2026
- Maximize Pipeline Throughput Under a Scaling BudgetOA · Seen Nov 2026
- Minimum Cost K-Capable ModelsOA · Seen Nov 2026
- Find Available Meeting RoomsOA · Seen Oct 2026
- Maximum Sum of a K-StarOA · Seen Oct 2026
Similar questions at other companies
- Maximum Team SizeExpedia · OAExpedia interview questions
- Batch Point-in-Range QueriesGoogle · PHONE SCREENGoogle interview questions
- Classify Heap Addresses from a Memory SnapshotSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
- Maximum Profit in Job SchedulingAmazon · PHONE SCREEN
- Earliest Meeting Time for All EmployeesCapital One · OACapital One interview questions
- Largest Team Where Every Pair OverlapsWalmart · OAWalmart interview questions
- Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
- Maximum Compatible Time WindowsIBM · OAIBM interview questions
- Merge Overlapping IntervalsGoldman Sachs · OAGoldman Sachs interview questions
- Linear InterpolatorTwo Sigma · OATwo Sigma interview questions