4 1 3 2 5 3 6 6 8
Choosing [1,3), [3,6), and [6,8) gives 3 non-overlapping intervals.
3
3 0 10 1 2 2 3
The intervals [1,2) and [2,3) can both be chosen, so the answer is 2.
2
5 1 4 4 7 2 3 3 5 7 9
One maximum choice is [2,3), [3,5), and [7,9), giving 3.
Given nnn half-open intervals [li,ri)[l_i, r_i)[li,ri), choose the maximum number of intervals so that no two chosen intervals overlap.