ranges[i] = [a, b] covers all integers from a to b inclusive.
Place marks at integer points so that every range contains **at least two** marks. Return the smallest possible number of marks.ranges=[[1, 4], [2, 6], [5, 8]] → 4
For example, marks 3, 4, 7, 8: [1, 4] contains 3 and 4, so does [2, 6], and [5, 8] contains 7 and 8. Three are not enough: [1, 4] and [5, 8] do not overlap and each needs two marks of its own.
ranges=[[0, 5], [0, 5], [3, 4]] → 2
Marks 3 and 4 lie in all three ranges.
ranges=[[1, 3], [3, 5]] → 3
ranges[i] is a pair [a, b]ranges=[[1, 4], [2, 6], [5, 8]]
4
Run checks the first 3 tests in your browser. Submit checks all 87 tests on the server, hidden ones included.