C++ || Using Sorting Technique || Simple ||
\tclass Solution {\n\tpublic:\n    int maxTwoEvents(vector>& events) {\n        int res=0;\n        int emax=0;\n        vector> start;\n        vector> end;\n 
\tclass Solution {\n\tpublic:\n    int maxTwoEvents(vector<vector<int>>& events) {\n        int res=0;\n        int emax=0;\n        vector<pair<int,int>> start;\n        vector<pair<int,int>> end;\n        for(int i=0;i<events.size();++i)\n            start.push_back({events[i][0],events[i][2]});\n        for(int i=0;i<events.size();++i)\n            end.push_back({events[i][1],events[i][2]});\n        sort(start.begin(),start.end());\n        sort(end.begin(),end.end());\n        int j=0;\n        for(int i=0;i<start.size();++i){\n            res = max(res,start[i].second);\n                while(end[j].first < start[i].first){\n                    emax = max(emax,end[j].second);\n                    j++;\n                }\n            res = max(res,start[i].second + emax);\n            \n        }\n        return res;\n    }\n\t};
[]