Two ranges [a,b] and [c,d] (a≤b, c≤d) overlap iff
- Acheck_circle
a <= d && c <= b
- B
a > d || c > b
- C
b - a < d - c
- D
a == c
Explanation
They DON'T overlap iff one ends before the other starts; negate that.
AP Computer Science A· difficulty 4/5
Two ranges [a,b] and [c,d] (a≤b, c≤d) overlap iff
a <= d && c <= b
a > d || c > b
b - a < d - c
a == c
Explanation
They DON'T overlap iff one ends before the other starts; negate that.
Want 10 more like this — adaptive to your weak spots?