overlaps method
Returns true if this Interval overlaps the other Interval.
other: The value to check for overlap with this instance.
These two intervals overlap
* *
* *
These intervals do not overlap
* *
* *
* *
* *
Implementation
bool overlaps(Interval other) {
if (other.start >= end) return false;
if (other.end <= start) return false;
return true;
}