Maximum Earnings From Taxi (c++)
\nclass Solution {\npublic:\n    bool static mycomp(vector<int>&a, vector<int>&b){\n    return a[1]<b[1];\n}\n   int find_lowerbound(int n, vector<int>&endtime,
```\nclass Solution {\npublic:\n    bool static mycomp(vector<int>&a, vector<int>&b){\n    return a[1]<b[1];\n}\n   int find_lowerbound(int n, vector<int>&endtime,  int x){\n       int  l=0; int r=n-1;\n       int ans=-1;\n       while(l<=r){\n           int mid=l+(r-l)/2;\n           if(endtime[mid]<=x){\n               ans=mid;\n               l=mid+1;\n           }\n           else{\n               r=mid-1;\n           }\n       }\n       return ans;\n   }\n    long long maxTaxiEarnings(int m, vector<vector<int>>&arr) {\n         int n=arr.size();\n         sort(arr.begin(), arr.end(), mycomp);\n         vector<int>endtime;\n         for(int i=0; i<n; i++){\n            endtime.push_back(arr[i][1]);\n         }\n         long long dp[n];\n         dp[0]=arr[0][2]+arr[0][1]-arr[0][0];\n         for(int i=1; i<n; i++){\n           int ind=find_lowerbound(i, endtime, arr[i][0]);           \n           long long profit=arr[i][2]+arr[i][1]-arr[i][0];\n           if(ind>=0){\n               profit+=dp[ind];\n           }\n           dp[i]=max(dp[i-1], profit);\n        }\n         return dp[n-1];\n    }\n};\n```
['Binary Search', 'Dynamic Programming', 'C']