Segment Overlap — Solution & Editorial
The intersection of [A,B] and [C,D] is [max(A,C), min(B,D)]; its length is clamped at zero.
Complexity: O(1)
The intersection of [A,B] and [C,D] is [max(A,C), min(B,D)]; its length is clamped at zero.
Complexity: O(1)