C++ DP
\nclass Solution {\npublic:\n  long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {\n    vector<long long> dp(n + 1);\n    sort(rides.begin(), rides.e
```\nclass Solution {\npublic:\n  long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {\n    vector<long long> dp(n + 1);\n    sort(rides.begin(), rides.end(), [](auto &f, auto&s)->bool { return f[1] < s[1]; });\n    for (int i = 1, j = 0; i <= n; ++i) {\n      dp[i] = dp[i - 1];\n      while (j < rides.size() && i == rides[j][1]) {\n        int s = rides[j][0], t = rides[j][2];\n        dp[i] = max(dp[i], dp[s] + i - s + t);\n        ++j;\n      }\n    }\n    return dp[n];\n  }\n};\n```
['C']