c++ simple O(n*logn) solution
\nclass Solution {\npublic:\n    int maxTwoEvents(vector<vector<int>>& events) {\n        sort(events.begin(),events.end(),[](auto& a, auto& b) {\n           re
```\nclass Solution {\npublic:\n    int maxTwoEvents(vector<vector<int>>& events) {\n        sort(events.begin(),events.end(),[](auto& a, auto& b) {\n           return a[0] < b[0];\n        });\n        int v = events.back()[2];\n        map<int,int> m; \n        for(int i = events.size()-1;i>=0;i--) {\n            v = max(v,events[i][2]);\n            m[events[i][0]] = v; \n        }\n        sort(events.begin(),events.end(),[](auto& a, auto& b) {\n           return a[1] < b[1];\n        });\n        int ret = 0; \n        for(int i = 0;i<events.size();i++) {\n            ret = max(ret,events[i][2]);\n            auto ptr = m.upper_bound(events[i][1]);\n            if(ptr != m.end()) {\n                ret = max(ret, events[i][2] + ptr->second);\n            }\n        }\n        return ret; \n    }\n};\n```
[]