Python3, Sort, Merge, Pow
Intuition\nFirst we sort ranges\nThen we are counting numberOfGroups by merging ranges.\n\nFinally we count answer\nIf group is going into FIRST -> assign 0\nIf
# Intuition\nFirst we sort ranges\nThen we are counting numberOfGroups by merging ranges.\n\nFinally we count answer\nIf group is going into FIRST -> assign 0\nIf group is going into SECOND -> assign 1\n\nThis means that the answer is power of 2.\n\n# Code\n```\nclass Solution:\n    def countWays(self, ranges: List[List[int]]) -> int:\n        ranges.sort()\n        A,B=-1,-1 # Artificial first Range, smallest non-Overlapping\n        numberOfGroups=0\n        for a,b in ranges:\n            if B<a:\n                # starting New Group\n                numberOfGroups+=1\n                A,B=a,b\n            else:\n                # same Group\n                B=max(B,b)\n        return pow(2,numberOfGroups,10**9+7)      \n```
['Python3']