I have to implement if there is no intervall overlap.
The Intervalls look like that:
0-100
100-200
200-500
500-1000
1000-2000 ect....
Right now the intervalls are stored seperately in an arraylist with min(0,100,200,500…) and max(100,200,500…)
If I add a new Intervall I have to check if there is no overlap to the existing intervalls.
ex.:
250-280 is ok
300-600 is not ok
However, I have no idea how to do that?
You can use an interval tree data structure for this task, and add elements only if there is no collisions / intersections in the interval.