Easy commented code using lower bound(learn how to use lb for vec of vec)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    \n    long long dp[100000]; // Dynamic programming table to store calculated results\n    \n\n    // Recursive function to calculate the maximum taxi earnings starting from index \'start\'\n    long long giveAns(vector<vector<int>>& rides, int start) {\n        // Base case: If the current index is beyond the rides array, return 0\n        if (start >= rides.size()) return 0;\n        \n        // If the result for the current index has already been calculated, return it\n        if (dp[start] != -1) return dp[start];\n        \n        // Find the position to jump to using binary search on the end times of rides\n        auto it = lower_bound(rides.begin(), rides.end(), rides[start][1],\n                              [](auto& vec, int value) { return vec[0] < value; });\n        \n        // Calculate earnings if the current ride is taken (x) and if it\'s skipped (y)\n        long long x = rides[start][2] + rides[start][1] - rides[start][0] +\n                      giveAns(rides, it - rides.begin()); // Recursive call\n        long long y = giveAns(rides, start + 1); // Recursive call\n        \n        // Store the maximum earnings for the current index in dp table and return it\n        return dp[start] = max(x, y);\n    }\n    \n    long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {\n        memset(dp, -1, sizeof(dp)); // Initialize the dp table with -1\n        sort(rides.begin(), rides.end()); // Sort rides based on start times\n        \n        // Call the recursive function starting from the first ride\n        return giveAns(rides, 0);\n    }\n};\n\n```
['Binary Search', 'Memoization', 'C++']