Sort Solution Time:- O(nlogn) Space:- O(1)
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:
        if not ranges:
            return 0
        ranges.sort()
        count = 1
        curr = ranges[0] 
        for start,end in ranges[1:]:

            if curr[1] < start:
                count += 1
            curr[1] = max(curr[1], end)
        # This is a constaraint for this problem is was thinking of doing 2**count earlier
        MOD = 10**9 + 7
        return pow(2, count, MOD)

```
['Python3']