A robotics lab has exactly one shared charging dock for all of its robots. Two robots have each reserved a window of time to plug into that dock, given as a start time and an end time on the same 24-hour clock. Because the dock can only serve one robot at any given instant, you must determine whether the two robots' reservation windows conflict — that is, whether there is at least one minute that falls inside both windows.
start1 end1 — the first robot's reservation window, each in 24-hour HH:MM format.start2 end2 — the second robot's reservation window, in the same format.Print true if the two windows share at least one common minute, or false if they never overlap.
HH:MM, with 00 <= HH <= 23 and 00 <= MM <= 59.Example 1
Input
01:15 02:00 02:00 03:00
Expected
true
Explanation
The first window covers 01:15 through 02:00 and the second covers 02:00 through 03:00. Both windows include the minute 02:00, so they conflict and the answer is true.
Example 2
Input
10:00 11:00 14:00 15:00
Expected
false
Explanation
The first window ends at 11:00 and the second does not begin until 14:00, so no minute belongs to both windows and the answer is false.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →