I have a set of ranges and an attribute value in those ranges as so -
Range Value
1-10 3
7-12 2
11-25 4
30-36 5
33-37 4
Expected result
Range Value
1-7 3
7-12 2
12-25 4
25-30 0
30-33 5
33-37 4
As, you can see, the ranges can overlap and also have gaps. The expectation is that we always choose the lowest value possible for the range.
Currently, I am initially sorting these ranges based on start offsets and then using a lot of if..else
conditions with start and end offset checks to achieve this. I wanted to know if there is any better and systematic way of doing this?
Aucun commentaire:
Enregistrer un commentaire