stalls[i] = [start, end] takes up every spot from start to end inclusive. Stalls may overlap.
Return how many distinct spots are taken by at least one stall.stalls=[[2, 4], [8, 9], [3, 6]] → 7
Spots 2–6 are taken (two stalls overlap there) plus 8–9: 5 + 2 = 7 in total.
stalls=[[5, 5], [5, 5]] → 1
Both stalls stand on spot 5, and it is counted only once.
stalls=[[1, 10], [4, 7]] → 10
stalls=[[2, 4], [8, 9], [3, 6]]
7
Run checks the first 3 tests in your browser. Submit checks all 87 tests on the server, hidden ones included.