Everything works well, but I would add a couple of tests.
First: an example of overlapped intervals. The second: the intervals swapped.
Otherwise, at the moment there is no need to check for duplication, nor to sort the final array.