✅Sorting || union-Find || sorting
\n# Code\n\nclass Solution {\npublic:\n\n    long long f(long long b,long long n){\n        long long N=1000000007;\n        if(n==0)return 1;\n        else if(
\n# Code\n```\nclass Solution {\npublic:\n\n    long long f(long long b,long long n){\n        long long N=1000000007;\n        if(n==0)return 1;\n        else if(n&1){\n            return (b*f(b,n-1))%N;\n        }\n        else{\n            return f((b*b)%N,n>>1);\n        }\n    }\n\n    int countWays(vector<vector<int>>& ranges) {\n        int n=ranges.size();\n        sort(ranges.begin(),ranges.end());\n        vector<vector<int>>arr;\n        for(int i=0;i<n;i++){\n            if(arr.size()==0)arr.push_back(ranges[i]);\n            else{\n                int arrs=arr.size();\n                long long fa=arr[arrs-1][0];\n                long long fb=arr[arrs-1][1];\n                long long ra=ranges[i][0];\n                long long rb=ranges[i][1];\n                if(ra<=fb){\n                    arr[arrs-1][1]=max(ranges[i][1],arr[arrs-1][1]);\n                }\n                else arr.push_back(ranges[i]);\n            }\n        }\n        // for(auto v:arr)cout<<v[0]<<"-"<<v[1]<<"\\n";\n        return f(2,arr.size());\n    }\n};\n```
['Array', 'Sorting', 'C++']