mstdn.science is one of the many independent Mastodon servers you can use to participate in the fediverse.

Administered by:

Server stats:

0
active users

Christos Argyropoulos MD, PhD

If one calls the code thus generated on a list of sorted intervals, the output is as expected, i.e. there are 2 groups of overlapping intervals,
First Group: [1,3] , [2,4]
Second Group: [5,7] , [6,8]

It works with an input of unsorted intervals (as expected). There are various tests that are not being done by the function e.g. for intervals of zero or negative lengths, duplicate intervals etc. The code's correctness is thus predicated on promises about the input.

Oops!An unexpected error occurred.
Oops!An unexpected error occurred.