Employee With the Most Overlaps
Updated
Problem statement
A company has n employees. Employee i starts work at time start[i] and finishes at time end[i]. The employee is working at every moment from start[i] to end[i], including both ends.
Two employees overlap when there is at least one moment when both are working. Because both ends count, an employee who finishes at time t overlaps an employee who starts at time t.
For each employee, count how many other employees overlap them. Return the largest of these counts.
Function
maxOverlapCount(start: int[], end: int[]) → intExamples
Example 1
start = [1,2,5,8]end = [10,3,6,9]return = 3Employee 0 works from 1 to 10, so it overlaps each of the other three employees. Each of the others overlaps only employee 0. The answer is 3, even though no more than two employees ever work at the same moment.
Example 2
start = [1,4,7]end = [4,7,10]return = 2Employee 1 works from 4 to 7. It shares time 4 with employee 0 and time 7 with employee 2, and both ends count. Employees 0 and 2 each overlap only employee 1.
Example 3
start = [3]end = [8]return = 0There are no other employees, so the count is 0.
Constraints
start.length == end.length == n1 <= n <= 2 * 1050 <= start[i] <= end[i] <= 109
More Citadel Online Assessment questions
- Speed Up a Slow FunctionOA · PHONE SCREEN · Seen Nov 2026
- Possible MEX Values After One Optional IncrementOA · Seen Oct 2026
- Busy IntersectionOA · Seen Sep 2026
- Shortest Path in an Unweighted GraphOA · Seen Sep 2026
- Maximize Workday EarningsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Minimum Changes for Palindromic BlocksOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Minimum Image Processing CostOA · Seen Jul 2026
- Coprime Pick with Change CostOA · Seen Jul 2026
- Process SchedulingOA · Seen Mar 2026
- Most Employees Working at OnceOA · Seen Feb 2026
Similar questions at other companies
- Maximum Interactive Team SizeMicrosoft · OAMicrosoft interview questions
- 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
- Count Lamps Lighting Each PointAirbnb · OAAirbnb interview questions
- Merge IntervalsApple · OA · PHONE SCREEN · ONSITE INTERVIEWApple interview questions
- 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
Citadel interview experiences
- Citadel Securities Quant Researcher Intern Loop: 1 Experience
- Citadel Securities Research Engineer Interview: 1 Experience
- Citadel Securities SWE Intern First Round: 2 Experiences
- Citadel Securities Experienced SWE Interviews: 1 Experience
- Citadel SWE Intern Later Rounds and Superday: 13 Experiences
- Citadel SWE Intern First-Round Questions: 20 Experiences