Skip to content

Determine if Two Events Have Conflict

EasyIntervals
Decode it first. Clues, constraints, pattern and plan before any code.

Two events happen on the same day. Each is a pair [start, end] of "HH:MM" times in 24-hour format, and both ends are inclusive. Return true if the two events share at least one minute, otherwise false.

event1 = ["01:15", "02:00"], event2 = ["02:00", "03:00"]  →  true    (both include 02:00)
event1 = ["01:00", "02:00"], event2 = ["01:20", "03:00"]  →  true
event1 = ["10:00", "11:00"], event2 = ["14:00", "15:00"]  →  false

Constraints

  • event1.length == event2.length == 2
  • Every time is a valid "HH:MM" string, zero padded.
  • start <= end within each event.