best code || beat 101% || (0ms)
\nCode block\n# 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# Com
```\nCode block\n```# 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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int countWays(vector<vector<int>>& ranges) {\n        long long i=0,n=ranges.size(),mod=1e9+7;\n        sort(ranges.begin(),ranges.end());\n        int mergesize=1;  \n        long long ans=2;  \n        int second = ranges[0][1];\n        for(i=1;i<n;i++){\n            if(ranges[i][0]<=second)second = max(second,ranges[i][1]);\n            else{\n                mergesize++;\n                second=ranges[i][1];\n                ans=(ans*2)%mod;\n            }\n        }\n        return ans;\n    }\n};
['C++']