Counting the number of ways the divide the ranges
\npython3 []\nclass Solution:\n    def countWays(self, ranges: List[List[int]]) -> int:\n        #Sort by start\n        sorted_ranges= sorted(ranges, key= lamb
\n```python3 []\nclass Solution:\n    def countWays(self, ranges: List[List[int]]) -> int:\n        #Sort by start\n        sorted_ranges= sorted(ranges, key= lambda x:x[0])\n        prev_end=sorted_ranges[0][0]\n        count=0   \n        for start,end in sorted_ranges:\n            #Count possible beakpoints when there is no overlap\n            if start>prev_end:\n                count+=1\n            prev_end= max(prev_end, end)\n        return (2**  (count+1)) %(10**9 +7) #Number of groups is break points +1\n```
['Python3']