Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.

Example:

[[1, 4], [2, 5], [5, 6], [3, 4]]

Output: In this example, removing [2, 5] and [3, 4] is sufficient. Thus, the answer is 2.