[DP+Lower Bound] Easy and Understandable
\nclass Solution {\npublic:\n    long long dp[100005];\n    \n    \n    long long fuck(vector<vector<int>>& rides, int i, vector<int> &start){\n        if(i >= 
```\nclass Solution {\npublic:\n    long long dp[100005];\n    \n    \n    long long fuck(vector<vector<int>>& rides, int i, vector<int> &start){\n        if(i >= rides.size())\n            return 0;\n        \n        if(dp[i]!=-1)\n            return dp[i];\n        long long a = fuck(rides,i+1,start);\n        long long add = lower_bound(start.begin(),start.end(),rides[i][1])-start.begin();\n        long long b = rides[i][1]-rides[i][0]+rides[i][2] + fuck(rides,add,start);\n        return dp[i] = max(a,b);\n    }\n    \n    long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {\n        memset(dp,-1,sizeof(dp));\n        sort(rides.begin(),rides.end());\n        int m = rides.size();\n        vector<int> start(m);\n        for(int i=0;i<m;i++){\n            start[i] = rides[i][0];\n        }\n        return fuck(rides,0,start);\n    }\n};\n```
['Dynamic Programming', 'C', 'Binary Tree']