I am looking for a nice way of flattening (splitting) a list of potentially-overlapping numeric ranges. The problem is very similar to that of this question: [Fastest way to split overlapping date ranges](https://stackoverflow.com/questions/5712472/fastest-way-to-split-overlapping-date-ranges/5713241#5713241), and many others. However, the ranges are not only integers, and I am looking for a decent algorithm that can be easily implemented in Javascript or Python, etc. __Example Data:__ ![Example data][1] __Example Solution:__ ![enter image description here][2] Apologies if this is a duplicate, but I am yet to find a solution. [1]: https://i.sstatic.net/NRAkh.png [2]: https://i.sstatic.net/HP8Ri.png