




Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Create intervals of the area covered by each tap, sort intervals by the left end.
We need to cover the interval [0, n]. we can start with the first interval and out of all intervals that intersect with it we choose the one that covers the farthest point to the right.
What if there is a gap between intervals that is not covered ? we should stop and return -1 as there is some interval that cannot be covered.