If I have got the question correctly, doesn't checking whether 2 intervals overlap a O(1) operation. Checking for the 4 possibilities should do the work. So just iterate over all the given intervals and check in O(1) if they overlap with the given interval.
If I have got the question correctly, doesn't checking whether 2 intervals overlap a O(1) operation. Checking for the 4 possibilities should do the work. So just iterate over all the given intervals and check in O(1) if they overlap with the given interval.
ReplyDeletePlease correct me if I have missed something.