Most Employees Working at Once
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.
Return the largest number of employees who are working at the same moment.
Note: an employee who finishes at time t and an employee who starts at time t are both working at time t.
Function
maxEmployeesAtOnce(start: int[], end: int[]) → intExamples
Example 1
start = [1,2,3,6]end = [4,3,7,8]return = 3At time 3, employees 0, 1 and 2 are all working. Employee 1 finishes at 3 and employee 2 starts at 3, and both ends count. When employee 3 starts at 6, only employee 2 is still working, so no moment has more than 3 employees.
Example 2
start = [1,3,6]end = [3,6,9]return = 2At time 3, employees 0 and 1 are both working. At time 6, employees 1 and 2 are. No moment has all three, because employee 0 finishes before employee 2 starts.
Example 3
start = [4]end = [4]return = 1The only employee works at the single moment 4.
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
- Employee With the Most OverlapsOA · Seen Feb 2026
Similar questions at other companies
- Minimum Machines for TasksExpedia · OAExpedia interview questions
- Meeting Rooms IIUber · PHONE SCREENUber interview questions
- Meeting Rooms IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Meeting Rooms IIWalmart · PHONE SCREENWalmart interview questions
- Earliest Common Meeting SlotAdobe · PHONE SCREENAdobe interview questions
- Intersect Multiple Interval ListsGoogle · ONSITE INTERVIEWGoogle interview questions
- Merge IntervalsApple · OA · PHONE SCREEN · ONSITE INTERVIEWApple interview questions
- Earliest Meeting Time for All EmployeesCapital One · OACapital One interview questions
- Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
- Maximum Interactive Team SizeMicrosoft · OAMicrosoft 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