# Divide Intervals Into Minimum Number of Groups (Leetcode 2406)

Problem Link: <https://leetcode.com/contest/weekly-contest-310/problems/divide-intervals-into-minimum-number-of-groups/>

```python
class Solution:
    def minGroups(self, intervals: List[List[int]]) -> int:
        
        n=len(intervals)
        s=[]
        e=[]
        for i in intervals:
            s.append(i[0])
            e.append(i[1])
        s.sort()
        e.sort()
        i=0
        j=0
        c=0
        ans=0
        while(i<n):
            if(s[i]<=e[j]):
                c+=1
                i+=1
                ans=max(ans,c)
            else:
                c-=1
                j+=1
        return ans
```
