Given an array of intervals, return the minimum number of intervals to remove to make the rest non-overlapping.
intervals = [[1,2],[2,3],[3,4],[1,3]]
1
intervals = [[1,2],[1,2],[1,2]]
2