Non-overlapping Intervals
You are given a two dimensional array containing arrays of intervals as an argument. Return the maximum number of non-overlapping intervals.
Requirements
- Must return a single integer
Example #1
solve([[1, 3],[4, 20]])
> 2
Neither of the arrays overlap, so we return 2
Example #2
solve([[1, 5],[4, 6],[9,12]])
> 1
Interval arrays 1,5 and 4,6 overlap but 9,12 does not, so we return 1.