133ms beats 99.12% solve by sorting and intervals
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: $$O(nlgn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int countWays(vector<vector<int>>& ranges) {\n        sort(ranges.begin(), ranges.end());\n        int mx = ranges[0][1], ans = 1, cnt = 1, mod = 1e9 + 7;\n        for(int i = 1;i < ranges.size();i++){\n            if(ranges[i][0] > mx) cnt++;\n            mx = max(mx, ranges[i][1]);\n        }\n\n        for(int i = 0;i < cnt;i++){\n            ans *= 2;\n            ans %= mod;\n        }\n\n        return ans;\n    }\n};\n\nauto init = []()\n{ \n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    return \'c\';\n}();\n```
['Array', 'Sorting', 'C++']