The usage of βxβ and βyβ in the diagram above makes this content difficult to understand, since on a cartesian plane variables named βx1β and βy1β would typically be paired together.
Given that the algorithm for solving these involves sorting these, using βleftβ and βrightβ may make this clearer.
This would make the answer to query #1: βmax(left1, right1) <= min(left2, right2)β.
Or using βaβ and βbβ: βmax(a1, b1) <= min(a2, b2)β.
1 Like
is overlap: each end must be greater than the other start.
end2 > start1 && end1 > start2
overlapping part: max of the starts to min of the ends
max(start1, start2) to min(end1, end2)