The intersection of time ranges

Report a typo

Write a program that reads time ranges and checks if they intersect. Two ranges are considered to have an intersection if they have at least one common point in time with minute accuracy. The format of the time points is hour:minute. Don't use seconds, millis, nano, etc.

Input data format

Two lines containing time ranges. Each time range consists of earlier and later time points separated by one space.

Output data format

"true" if the given intervals intersect, "false" otherwise.

Sample Input 1:

00:10 00:20
00:15 00:30

Sample Output 1:

true

Sample Input 2:

13:50 14:40
14:40 15:30

Sample Output 2:

true

Sample Input 3:

20:20 21:40
19:30 20:18

Sample Output 3:

false
Write a program in Java 17
class Main {
public static void main(String[] args) {
// put your code here
}
}
___

Create a free account to access the full topic