p1
and p2
, to -1, representing the last two elements of the current minimum containing set.p2
. If so, add two new elements to the containing set and update p1
and p2
to the last two elements of the interval.p1
, add one new element to the containing set and update p1
to p2
and p2
to the end point of the interval.p1
, continue to the next interval as the current set already satisfies the interval.