length boards numbered 0 to length - 1. Painters went over it several times: each element of coats is a pair [from, to] meaning every board from from to to inclusive got painted. The strokes may overlap and come in any order.
Find all unpainted stretches: each one is a maximal run of consecutive bare boards that cannot be extended to the left or right. Return them as pairs [first, last] sorted by increasing first. If no board is bare, return an empty list.length=12, coats=[[2, 4], [7, 9], [3, 5]] → [[0, 1], [6, 6], [10, 11]]
Boards 2–5 and 7–9 are painted. Boards 0–1, 6 and 10–11 stay bare.
length=4, coats=[[0, 1], [2, 3]] → []
The two strokes together cover the whole fence, so no board is bare.
length=5, coats=[] → [[0, 4]]
length=12, coats=[[2, 4], [7, 9], [3, 5]]
[[0, 1], [6, 6], [10, 11]]
Run checks the first 3 tests in your browser. Submit checks all 79 tests on the server, hidden ones included.