
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Convert lights into an array of ranges representing the range where each street light can light up and sort the start and end points of the ranges.
Do we need to traverse all possible positions on the street?
No, we don't, we only need to go to the start and end points of the ranges for each streetlight.