Do They Intersect?

Let aa, bb, cc, dd be integers such that aba\leq b and cdc\leq d. Write a function do_they_intersect(a, b, c, d) that tells us whether the open intervals (a,b)(a, b) and (c,d)(c, d) have a nonempty intersection.

Observation

Only the function will be evaluated. If your submission includes a main program (e.g. with testmod), it must be either commented out or inside a condition if __name__ == ’__main__’

Problem information

Author: Jordi Delgado and José Luis Balcázar

Generation: 2026-01-25T16:47:57.949Z

© Jutge.org, 2006–2026.
https://jutge.org