Recursion->Memoization->Tabulation
Recursion\n\nclass Solution {\npublic:\n    int getNextCurr(vector<vector<int>>& rides,int start,int key){\n        int end=rides.size()-1;\n        int nextCur
# Recursion\n```\nclass Solution {\npublic:\n    int getNextCurr(vector<vector<int>>& rides,int start,int key){\n        int end=rides.size()-1;\n        int nextCurr=rides.size();\n        while(start<=end){\n            int mid=(start+end)/2;\n            if(rides[mid][0]>=key){\n                nextCurr=mid;\n                end=mid-1;\n            }\n            else start=mid+1;\n        }\n        return nextCurr;\n\n    }\n    long long maxIncome(int curr,vector<vector<int>>& rides){\n        if(curr==rides.size())return 0;\n        long long notpick=maxIncome(curr+1,rides);\n        int nextCurr=getNextCurr(rides,curr,rides[curr][1]);\n        long long pick=(rides[curr][1]-rides[curr][0]+rides[curr][2])+maxIncome(nextCurr,rides);\n        return max(pick,notpick);\n    }\n    long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {\n        sort(rides.begin(),rides.end());\n        return maxIncome(0,rides);\n        \n    }\n};\n```\n# Memoization\n```\nclass Solution {\npublic:\n    int getNextCurr(vector<vector<int>>& rides,int start,int key){\n        int end=rides.size()-1;\n        int nextCurr=rides.size();\n        while(start<=end){\n            int mid=(start+end)/2;\n            if(rides[mid][0]>=key){\n                nextCurr=mid;\n                end=mid-1;\n            }\n            else start=mid+1;\n        }\n        return nextCurr;\n\n    }\n    long long maxIncome(int curr,vector<vector<int>>& rides,vector<long long>& dp){\n        if(curr==rides.size())return 0;\n        if(dp[curr]!=-1) return dp[curr];\n        long long notpick=maxIncome(curr+1,rides,dp);\n        int nextCurr=getNextCurr(rides,curr,rides[curr][1]);\n        long long pick=(rides[curr][1]-rides[curr][0]+rides[curr][2])+maxIncome(nextCurr,rides,dp);\n        return dp[curr]=max(pick,notpick);\n    }\n    long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {\n        sort(rides.begin(),rides.end());\n        vector<long long> dp(rides.size(),-1);\n        return maxIncome(0,rides,dp);\n        \n    }\n};\n```\n\n# Tabulation\n```\nclass Solution {\npublic:\n    int getNextCurr(vector<vector<int>>& rides,int start,int key){\n        int end=rides.size()-1;\n        int nextCurr=rides.size();\n        while(start<=end){\n            int mid=(start+end)/2;\n            if(rides[mid][0]>=key){\n                nextCurr=mid;\n                end=mid-1;\n            }\n            else start=mid+1;\n        }\n        return nextCurr;\n\n    }\n\n    long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {\n        sort(rides.begin(),rides.end());\n        vector<long long> dp(rides.size()+1,0);\n        for(int curr=rides.size()-1;curr>=0;curr--){\n            long long notpick=dp[curr+1];\n            int nextCurr=getNextCurr(rides,curr,rides[curr][1]);\n            long long pick=((long long)rides[curr][1]-(long long)rides[curr][0]+(long long)rides[curr][2])+dp[nextCurr];\n            dp[curr]=max(pick,notpick);\n\n        }\n        return dp[0];\n   \n    }\n};\n```
['Binary Search', 'Dynamic Programming', 'Recursion', 'Memoization', 'C++']