The most frequent integer value from set of intervals What is the fastest way to get one of the value from set of intervals which occurs most frequently?

For example if I have interval (0, 3) and (2, 4) the most frequent value can be 2 or 3.
It seems to me that the answer to your question will have a technique similar to this - https://stackoverflow.com/a/9676296/477522