Easy to understand solution in python
```\nfrom collections import *\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:\n        d = defaultdict(list)\n        d
```\nfrom collections import *\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:\n        d = defaultdict(list)\n        dp = [0] * (n+1)\n        for s,e,v in rides:\n            d[e].append((s,v))\n        for i in range(1,n+1):\n            mxm = dp[i-1]\n            for s,v in d[i]:\n                mxm = max(mxm,i - s + v + dp[s])\n            dp[i] = mxm\n        return dp[-1]
['Dynamic Programming', 'Python', 'Python3']