Merge Intervals Question
Complexity\n- Time complexity:O(Nlogn + N)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O((n))\n Add your space complexity here, e.g. O(n) 
# Complexity\n- Time complexity:O(Nlogn + N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O((n))\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int countWays(vector<vector<int>>& in) {\n        const int mod = 1e9 + 7;\n        if (in.empty()) return 0;  \n        sort(in.begin(), in.end());\n        vector<vector<int>> r;\n        int mine = in[0][0];\n        int maxe = in[0][1];\n        \n        for (int i = 1; i < in.size(); i++) {\n            if (in[i][0] <= maxe) {\n                maxe = max(maxe, in[i][1]);\n            } else {\n                r.push_back({mine, maxe});\n                mine = in[i][0];\n                maxe = in[i][1];\n            }\n        }\n        \n        r.push_back({mine, maxe});  \n        int n = r.size();\n        int a = 1;\n        while(n--){\n            a = 2*a % mod;\n        }\n        return a;\n    }\n};\n\n```
['C++']