[Python] Fast Clean Python DP Solution (6 lines)
First of all, sort by start time so you can reliably use bisect to find next index.\n\n\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List
First of all, sort by start time so you can reliably use bisect to find next index.\n\n```\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:\n        rides.sort(key=lambda x: x[0])\n        res = [0] * (len(rides) + 1)\n        for i in range(len(rides) - 1, -1, -1):\n            idx = bisect.bisect(rides, [rides[i][1]])\n            res[i] = max(res[idx] + rides[i][1] - rides[i][0] + rides[i][2], res[i + 1])\n\n        return res[0]\n```
[]