FastPrepMaximum Concurrent Meeting Time Slots

Maximum Concurrent Meeting Time Slots

Bloomberg LP logoBloomberg LP● MediumNEW GRADONSITE INTERVIEW
Learn

Problem statement

Each meeting occupies the half-open interval [start,end). Return every maximal positive-length interval during which the global maximum number of meetings is active, ordered by time. Merge adjacent output intervals with the same maximum count.

Return an empty array when there are no meetings.

Function

maximumConcurrentSlots(meetings: int[][]) → int[][]

Examples

Example 1

meetings = [[100,300],[145,215],[200,230],[215,300],[215,400],[500,600],[600,700]]return = [[215,230]]

Four meetings are active throughout [215,230), the global maximum.

Constraints

  • At most 10^5 meetings.
  • start < end.

More Bloomberg LP problems

See Bloomberg LP hiring insights
public int[][] maximumConcurrentSlots(int[][] meetings) {
  // Write your code here.
}
meetings[[100,300],[145,215],[200,230],[215,300],[215,400],[500,600],[600,700]]
expected[[215,230]]
Checking account…