问题
There are N ranges [l1,r1],[l2,r2],…,[lN,rN]
. rosy wants to divide the ranges into two non-empty subsets in such a way that each range is in exactly one subset and whenever two ranges have a common point, they are in the same subset.
Since this could be difficult to achieve, rosy can delete any number of ranges (possibly zero) and then divide the remaining ranges into such non-empty subsets. She wants to know whether it is possible to achieve her task after deleting some ranges and if it is possible, she also wants to know the minimum number of ranges she needs to delete to achieve it.
> For example if the input ranges are [1,4],[2,6],[5,7]
> Out put should be 1 as deleting [2,6] is sufficient.
>if input is [1,4] and [4,6]
>out put should be -1
>if input ranges are [3,7] and [8,9]
>the out put should be 0
My question is what exactly she wants to do .If possible suggest some test cases.
来源:https://stackoverflow.com/questions/59307236/dividing-n-ranges-into-two-subsets