result
to store the final set of intervals.intervals
list.toBeRemoved
. If so, add the interval to result
.toBeRemoved
is entirely inside the interval.result
.result
list, which now contains the set of real numbers with toBeRemoved
removed.