Do Two Meetings Overlap?

Medium ⏱ 12 min 57% acceptance ★★★★☆ 4.2
Meetings are (start, end) tuples of datetime objects (end exclusive). Write overlaps(a, b) returning True when the two intervals intersect. The classic one-liner: a starts before b ends AND b starts before a ends.

Examples

Example 1
Input
overlaps((dt(2026,1,1,10), dt(2026,1,1,11)), (dt(2026,1,1,10,30), dt(2026,1,1,12)))
Output
True
Explanation

10:30 falls inside 10:00-11:00.

Constraints

  • End-exclusive: back-to-back meetings do NOT overlap.
  • One boolean expression suffices.

Topics

Date & Timeinterval logic

Companies

GoogleMicrosoftZoom

Hints

Hint 1

a_start < b_end and b_start < a_end.

Hint 2

Strict < gives end-exclusivity.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.