For a project which I am doing, I have a list of sets in the form of
[ [start, end] ]
For example
[{1, 3} {2, 4} {5, 9} {6, 8} {7, 8}]
The array is in sorted form.
I want to find the number of overlapping collisions. For example from the example dataset.
The result I want is like the following.
Interval | Collisions
----------------------
{7,8} | 3
{2,3} | 2
{6,7} | 2
{1,2} | 1
{3,4} | 1
{5,6} | 1
{8,9} | 1
What is the ideal way to achieve it ?