As reported: Walmart Senior Software Engineer HackerRank OA (2026), DSA part: given the arrays
startTimeandendTimeof employees' working hours, find the maximum team size such that every employee in the team can interact with every other member.
Employee i works during [startTime[i], endTime[i]]. Two employees can interact when their working hours overlap. Return the size of the largest team in which every pair of members can interact.
Example 1
startTime = [1, 2, 5, 7], endTime = [4, 6, 8, 9] -> 2
[1,4] and [2,6] overlap, and so do [5,8] and [7,9], but no three intervals all overlap each other.
Example 2
startTime = [2, 5, 6, 8], endTime = [5, 6, 10, 9] -> 2
Example 3
startTime = [1, 3], endTime = [3, 5] -> 2 (they meet at time 3)
Clarifications
- Intervals are closed: two intervals that only touch at an endpoint (
[1,3]and[3,5]) overlap. - A single employee is a valid team, so the answer is at least 1.
Constraints: 1 ≤ n ≤ 10^5; 0 ≤ startTime[i] ≤ endTime[i] ≤ 10^9.
Code runner format: one JSON value per line: startTime, then endTime. Implement maxTeamSize(startTime, endTime); the harness prints the team size.