Determine whether two time intervals overlap at any moment.
Given the start and end times of two events in 24-hour HH:MM format, determine whether the events conflict.
Two events conflict if their time ranges overlap by at least one minute. Events that only touch at an endpoint do not conflict.
Return true if the events conflict, otherwise return false.
Input Format
- Two events are given as strings in
HH:MMformat. - Each event is represented by a start time and an end time.
- Times are within the same day.
Output Format
Return a boolean value indicating whether the two events overlap.
Constraints
- Times use 24-hour format
00:00to23:59. - Each event has a valid start time and end time.
- You may assume event intervals are non-empty.
- Endpoint-touching intervals are not considered conflicts.
Example 1
Input
event1 = ["01:15","02:00"], event2 = ["02:00","03:00"]
Output
false
Explanation
The first event ends exactly when the second event starts, so they do not overlap.
Example 2
Input
event1 = ["01:00","02:30"], event2 = ["02:00","03:00"]
Output
true
Explanation
The events overlap from 02:00 to 02:30.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.