FastPrepMeeting Concurrency Intervals

Meeting Concurrency Intervals

Google logoGoogle● MediumFULLTIMEONSITE INTERVIEW
Learn

Problem statement

Given meeting intervals and a positive target x, return each maximal half-open interval during which exactly x meetings are active.

Function

exactMeetingConcurrency(meetings: int[][], x: int) → int[][]

Examples

Example 1

meetings = [[1,4],[2,5],[4,6]]x = 2return = [[2,5]]

A simultaneous end and start keeps the count at two.

Example 2

meetings = [[1,3],[1,3]]x = 2return = [[1,3]]

Both meetings are active throughout the interval.

Constraints

  • 0 <= meetings.length <= 100000
  • Each row is [start,end] with start <= end.
  • 1 <= x <= meetings.length + 1

More Google problems

See Google hiring insights
public int[][] exactMeetingConcurrency(int[][] meetings, int x) {
  // Write your code here.
}
meetings[[1,4],[2,5],[4,6]]
x2
expected[[2,5]]
Checking account…