find the number of all nonoverlapping interval pairs from the array

an array.
given indexes of each interval (start, end) in the array: starting[] = [3, 1, 2, 8, 8], ending[] = [5, 3, 7, 10, 10]
find the number of all nonoverlapping interval pairs from the array
result: 3 pairs, (3, 5) and (8, 10); (1, 3) and (8, 10); (2, 7) and (8, 10)
should not consider duplicate intervals

Comments (0)