Place every inclusive interval [left, right] from intervals into exactly one group. Intervals within a group must share no point. Touching at an endpoint counts as an intersection, so such intervals must go into different groups. An interval may consist of a single point, and duplicate intervals are separate entries that must each be assigned. Return the smallest possible number of groups.
Example 1:
Input: intervals = [[1,3],[3,5]]
Output: 2Explanation: Both intervals include 3, so they must be placed in separate groups. Two groups are sufficient.
Example 2:
Input: intervals = [[1,2],[4,5],[7,7]]
Output: 1Explanation: No pair intersects. Put all three intervals, including the single-point interval [7,7], into one group.
Example 3:
Input: intervals = [[2,4],[2,4],[2,4]]
Output: 3Explanation: These are three separate interval entries. They all overlap, so each needs its own group, for a total of 3.
Constraints:
1 <= intervals.length <= 100000- Every interval contains exactly two integers.
1 <= left <= right <= 1000000