C++| Easy to Understand using Sorting✅✅
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(nlog(n))\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 power(int n){\n        int ans=1;\n        while(n--){\n            ans=(ans*2)%1000000007;\n        }\n        return ans;\n    }\n    \n    int countWays(vector<vector<int>>& ranges) {\n        sort(ranges.begin(), ranges.end());\n        vector<vector<int>>ans;\n        for(int i=0; i<ranges.size(); i++){\n            if(ans.empty()){\n                ans.push_back(ranges[i]);\n            }\n            else{\n                vector<int> &v=ans.back();\n                if(ranges[i][0]<=v[1]){\n                    v[1]=max(v[1],ranges[i][1]);\n                }\n                else{\n                    ans.push_back(ranges[i]);\n                }\n            }\n        }\n        return power(ans.size());\n    }\n};\n```
['Array', 'Sorting', 'C++']