c++ | dp | Job scheduling variation | binary seaech
\nclass Solution {\npublic:\n    long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {\n        for(auto&i:rides)i[2]+=(i[1]-i[0]);\n        map<long l
```\nclass Solution {\npublic:\n    long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {\n        for(auto&i:rides)i[2]+=(i[1]-i[0]);\n        map<long long,long long>mp;\n        sort(rides.begin(),rides.end(),greater<vector<int>>());\n        long long mx=0;\n        for(auto& r:rides){\n            auto j= mp.lower_bound(r[1]);\n            long long v=j==mp.end()?0:j->second;\n            mx=max(mx,r[2]+v);\n            mp[r[0]]=mx;\n        }\n        return mx;\n    }\n};\n```
['Dynamic Programming', 'C', 'Binary Tree']