Python3 sort + merge intervals + count:  Time complexity: O(nlogn)
Intuition\nSort and merge the intervals and the collapsed intervals can be placed into 2 groups accordingly and counted.\n# Approach\n1) Sort the intervals base
# Intuition\nSort and merge the intervals and the collapsed intervals can be placed into 2 groups accordingly and counted.\n# Approach\n1) Sort the intervals based on start.\n2) Merge the overlapping intervals and non-overlapping in result array.\n3) For the result array elements, there are 2 possible choices: group1/group 2 for all elements upto length(result) which is equal to 2 ** len(result) \n\n# Complexity\n- Time complexity:\nO(nlogn) for sorting the intervals, merging takes O(n), counting takes O(1) so overall its O(nlogn)\n\n- Space complexity:\nO(n) for the result array.\n\n# Code\n```\nclass Solution:\n    def countWays(self, ranges: List[List[int]]) -> int:\n        ranges.sort()\n        result = [ranges[0]]\n        for i in range(1, len(ranges)):\n            if result[-1][1] >= ranges[i][0]:\n                result[-1][1] = max(result[-1][1], ranges[i][1])\n            else:\n                result.append(ranges[i])\n        return int((2 ** len(result)) % ((10 ** 9 ) + 7))           \n```
['Python3']