[Java/Python 3] Count non-overlapping components and double accordingly.
Sort the ranges to find the number of non-overlapping components, and for each component, we have 2 options: put it into group 1 or 2.\n\nTherefore, the answer 
Sort the `ranges` to find the number of non-overlapping components, and for each component, we have 2 options: put it into group `1` or `2`.\n\nTherefore, the answer is `2 ^ (# of componenets)`.\n\n```java\n    public int countWays(int[][] ranges) {\n        Arrays.sort(ranges, Comparator.comparingInt(r -> r[0]));\n        int cnt = 1, hi = -1;\n        for (int[] r : ranges) {\n            if (hi < r[0]) {\n                cnt <<= 1;\n                cnt %= 1_000_000_007;\n            }\n            hi = Math.max(hi, r[1]);\n        }\n        return cnt;\n    }\n```\n\n```python\n    def countWays(self, ranges: List[List[int]]) -> int:\n        cnt, hi = 1, -1\n        for a, b in sorted(ranges):\n            if hi < a:\n                cnt <<= 1\n                cnt %= 10 ** 9 + 7\n            hi = max(hi, b)\n        return cnt\n```\n**Analysis:**\n\nTime: `O(nlogn)`, space: `O(n)` - including sorting space.
['Java', 'Python3']