Determine if Two Events Have Conflict

You are given two arrays of strings that represent two inclusive events that happened on the same day, event1 and event2, where:

  • event1 = [startTime1, endTime1]
  • event2 = [startTime2, endTime2]

Event times are valid 24-hour format in the form of HH:MM.

A conflict happens when two events have some non-empty intersection, meaning some moment is common to both events.

Return true if there is a conflict between the two events. Otherwise, return false.

Example 1
Inputevent1 = ["01:15","02:00"], event2 = ["02:00","03:00"]
Outputtrue
The two events intersect at time 2:00.
Example 2
Inputevent1 = ["01:00","02:00"], event2 = ["01:20","03:00"]
Outputtrue
The two events intersect starting from 01:20 to 02:00.

Constraints

  • event1.length == event2.length == 2
  • event1[i].length == event2[i].length == 5
  • startTime1 <= endTime1
  • startTime2 <= endTime2
  • All the event times follow the HH:MM format.

Asked at 2 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate