Compound Boolean Expressions

AP Computer Science A· difficulty 4/5

Two ranges [a,b] and [c,d] (a≤b, c≤d) overlap iff

  • A

    a <= d && c <= b

    check_circle
  • 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.

Want 10 more like this — adaptive to your weak spots?

Related questions