|
|
|
|
|
by SyzygyRhythm
253 days ago
|
|
Even with the visualization, I found the minimal solution hard to visualize. I came up with this instead: Suppose you start with two separated intervals. The left one starts sliding rightward. At what point do they contact? That's easy, it's just when (end1 > start2). As it continues sliding, at what point do they lose contact? Again, easy: it's where (start1 >= end2). So the solution is the first condition and the negation of the second, i.e.: (end1 > start2) && (start1 < end2) |
|