Simple C++ Solution || Merge Intervals based
Intuition\nSimple merge intervals approach\n Describe your first thoughts on how to solve this problem. \n\n# Complexity\n- Time complexity: O(nlogn) + O(n)\n A
# Intuition\nSimple merge intervals approach\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Complexity\n- Time complexity: O(nlogn) + O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n- O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    static bool comp(vector<int> &a , vector<int> &b)\n    {\n        if(a[0] ==  b[0])\n            return a[1] < b[1];\n        return a[0] < b[0];\n    }\n    int countWays(vector<vector<int>>& ranges) {\n        \n        sort(ranges.begin() , ranges.end() , comp);\n        \n        long cnt = 1 , n = ranges.size();\n        int maxEnd = ranges[0][1];\n        for(int i=1;i<n;i++)\n        {\n            if(ranges[i][0] > maxEnd)\n               cnt++;\n            maxEnd = max(maxEnd , ranges[i][1]);\n        }\n        long mod = 1e9+7 , res = 1;\n        while(cnt--)\n        {\n            res *= 2;\n            res %= mod;\n        }\n        \n        return res;\n        \n    }\n};\n```
['C']