jasonbogd jasonbogd - 2 months ago 17
C Question

Determine if ranges overlap

Given two events with integer start and end times, E1 = (s1, e1), E2 = (s2, e2), implement a quick boolean check to see if the events overlap.

I have the solution, but I'm curious to see what others come up with.

EDIT: OK, here's my solution:

e1 > s2 || (s1 > s2 && e2 < s1)


bool overlap = (s1 <= e2) && (s2 <= e1)