FastPrepMeeting Rooms

Meeting Rooms

Goldman Sachs logoGoldman Sachs● EasyNEW GRADPHONE SCREEN
Learn

Problem statement

Each meeting is a half-open interval [start, end). Return true if one person can attend every meeting without overlap.

Function

canAttendMeetings(intervals: int[][]) → boolean

Examples

Example 1

intervals = [[0,30],[5,10],[15,20]]return = false

The first meeting overlaps the others.

Example 2

intervals = [[7,10],[10,12]]return = true

Half-open intervals may touch at an endpoint.

Constraints

  • There are at most 10^5 intervals.
  • start < end for every interval.

More Goldman Sachs problems

See Goldman Sachs hiring insights
public boolean canAttendMeetings(int[][] intervals) {
  // Write your code here.
}
intervals[[0,30],[5,10],[15,20]]
expectedfalse
Checking account…