Skip to content
Decoder

Determine if Two Events Have Conflict

Easy

Problem

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.

Example 1

Input
event1 = ["01:15", "02:00"], event2 = ["02:00", "03:00"]
Output
true
Why
both include 02:00

Example 2

Input
event1 = ["01:00", "02:00"], event2 = ["01:20", "03:00"]
Output
true

Example 3

Input
event1 = ["10:00", "11:00"], event2 = ["14:00", "15:00"]
Output
false

Constraints

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

Read it once before you touch anything

Want some pressure? Start the timer. In an interview you get about two minutes to understand the problem.

  1. 1Read the goalWhat goes in, what comes out
  2. 2Scan the examplesCheck one by hand
  3. 3Note the constraintsThey set your Big O
Say what it asks in one sentence
Say it out loud first, then compare with ours.