Skip to the code
cf.
+10 XP

#581 Clash-Free Calendar Check

easy

Before showing a "you're free all day" badge, a calendar widget checks a person's meetings for clashes. Each meeting is [start, end]. A meeting that starts exactly when another ends doesn't clash with it.

Write isClashFree(meetings) that returns true if no two meetings overlap, and false otherwise.

Example 1

Input: meetings = [[7,10],[2,4]]
Output: true

The meetings are far apart.

Example 2

Input: meetings = [[0,40],[10,15],[20,25]]
Output: false

[10, 15] happens during [0, 40].

Constraints

  • 0 <= meetings.length <= 100000
  • 0 <= start < end <= 10^6
Saved in this browser

Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.

Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).