You are given two intervals, interval1 and interval2, where each interval is represented as an array of two integers [start, end]. Your task is to determine if these two intervals overlap.
Two intervals overlap if they share at least one common point. For instance, [1, 5] and [3, 7] overlap because they share the range [3, 5]. Similarly, [1, 3] and [3, 5] overlap at point 3.
The start of an interval is always less than or equal to its end (start <= end).
interval1 = [1, 5]
interval2 = [3, 7]
True
The intervals [1, 5] and [3, 7] overlap in the range [3, 5].
interval1 = [1, 2]
interval2 = [3, 4]
False
The intervals [1, 2] and [3, 4] do not share any common points.
interval1 = [1, 10]
interval2 = [3, 7]
True
The interval [3, 7] is entirely contained within [1, 10], hence they overlap.
interval1 = [1, 3]
interval2 = [3, 5]
True
The intervals [1, 3] and [3, 5] touch at point 3, which counts as an overlap.
interval1 = [1, 5]
interval2 = [3, 7]
True