#2446

Determine if Two Events Have Conflict

pupil · 435 · lc easy +25 · verified · 53.1% accepted · 534 likes · top 44%

Description

Two events are each described by a start and end time string in the format "HH:MM". event1 = [start1, end1] and event2 = [start2, end2].

Return true if the events overlap (share any point in time), otherwise false.

Example 1:

Input: event1 = ["01:15","02:00"], event2 = ["02:00","03:00"]
Output: true
Explanation: The two events intersect at time 2:00.

Example 2:

Input: event1 = ["01:00","02:00"], event2 = ["01:20","03:00"]
Output: true
Explanation: The two events intersect starting from 01:20 to 02:00.

Example 3:

Input: event1 = ["10:00","11:00"], event2 = ["14:00","15:00"]
Output: false
Explanation: The two events do not intersect.

Code

1
2
3