A question similar to What's the most efficient way to test two integer ranges for overlap? but a little more advanced:
Let we are given two inclusive integer number ranges [x1:x2] and [y1:y2], where x1 ≤ x2 and y1 ≤ y2.
x1 and/or y1 can be an integer or minus infinity (represented as None
Python object), x2 and/or y2 can be an integer or plus infinity (represented as None
Python object).
What is the best way to test whether there is any overlap of the two ranges?
I am sure I can write an algorithm, but maybe you will find a shorter Python code for me?
(In fact, I deal not with integers but with version strings like "3.7". But I think I will have no trouble moving from integers to version strings by myself.)