Simple Sorting C++✅| Easy Solution
\n\n# Code\n\nclass Solution {\npublic:\n    int countWays(vector<vector<int>>& ranges) {\n        int mod=1e9+7;\n        int n=ranges.size();\n        \n     
\n\n# Code\n```\nclass Solution {\npublic:\n    int countWays(vector<vector<int>>& ranges) {\n        int mod=1e9+7;\n        int n=ranges.size();\n        \n        sort(ranges.begin(),ranges.end());\n        int c=1,end=ranges[0][1];\n        for(int i=1;i<n;i++){\n            if(ranges[i][0]<=end){\n                end=max(end,ranges[i][1]);\n            }else{\n                end=ranges[i][1];\n                c++;\n            }\n        }\n        vector<int> dp(c+1);\n        for(int i=0;i<=c;i++){\n            (i==0)?dp[i]=1:dp[i]=(2*dp[i-1])%mod;\n            \n        }\n        \n        return dp[c];\n    }\n};\n```
['Array', 'Sorting', 'C++']