def largest_team(start_time: list[int], end_time: list[int]) -> int:
Form the largest team of employees such that at least one member, the core employee, has office hours that overlap the hours of every other member of the team.
As reported (translated from the poster's Chinese):
You are given the office-hour intervals of n employees,
[startTime[i], endTime[i]]. You need to form a team in which at least one "core employee" exists whose working hours intersect the working hours of every other member of the team. Find the maximum number of employees the team can contain.
startTime = [2, 5, 6, 8]
endTime = [5, 6, 10, 9]
Output: 3
The poster adds: there is a time limit, and an O(n²) solution does not pass every test.
[5, 6], the team is [2, 5], [5, 6] and [6, 10]: the core shares only the moment 5 with the first and only the moment 6 with the third.[2, 5] and [6, 10] never meet, yet both are on that team. No single moment lies inside three of the intervals, and the answer is still 3.startTime[i] ≤ endTime[i] always holds.One report: a Citadel campus software engineering online assessment on HackerRank, two problems in 75 minutes (December 2025); the other problem was the process-scheduling count. The poster notes a time limit that O(n²) does not pass. Their proposed method, the most intervals through one endpoint found with a sweep line, returns 2 on their own posted example, where the answer is 3 (our check), because the rule only needs the core to overlap everyone. No input sizes or outcome were reported.
Form the largest team of employees such that at least one member, the core employee, has office hours that overlap the hours of every other member of the team.
As reported (translated from the poster's Chinese):
You are given the office-hour intervals of n employees,
[startTime[i], endTime[i]]. You need to form a team in which at least one "core employee" exists whose working hours intersect the working hours of every other member of the team. Find the maximum number of employees the team can contain.
startTime = [2, 5, 6, 8]
endTime = [5, 6, 10, 9]
Output: 3
The poster adds: there is a time limit, and an O(n²) solution does not pass every test.
[5, 6], the team is [2, 5], [5, 6] and [6, 10]: the core shares only the moment 5 with the first and only the moment 6 with the third.[2, 5] and [6, 10] never meet, yet both are on that team. No single moment lies inside three of the intervals, and the answer is still 3.startTime[i] ≤ endTime[i] always holds.| Approach | Notes |
|---|---|
| Most intervals through one endpoint (sweep line) | The poster's own proposal. By our check it assumes every member shares one common moment, which the rule does not require, and it returns 2 on the posted example, where the answer is 3. |
| Every employee as the core, O(n²) | Correct, but the poster reports that O(n²) does not pass every test. |
Why people fail: The poster reports that an O(n²) solution does not pass every test
Send them this page. It is free to read, no account needed.
What you just read — canonical solution, follow-up arc, what passing candidates actually did — exists for all 62 Citadel questions, refreshed monthly from new candidate reports.