2580. Count Ways to Group Overlapping Ranges
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def countWays(self, ranges: List[List[int]]) -> int:
        max_value = 10**9 + 7
        last_limit, group_count = -1, 0
        for start, end in sorted(ranges, key=lambda x: x[0]):
            if last_limit < start:
                group_count += 1
            last_limit = max(last_limit, end)
        return (2 ** group_count) % max_value

```
['Python3']