[Python3] dp
Please check out this commit for the solutions of biweekly 61. \n\ntop-down\n\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) ->
Please check out this [commit](https://github.com/gaosanyong/leetcode/commit/0dcbb71853720dc380becdd8968bf94bdf419b7d) for the solutions of biweekly 61. \n\n**top-down**\n```\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:\n        mp = {}\n        for start, end, tip in rides: \n            mp.setdefault(start, []).append((end, tip))\n        \n        @cache\n        def fn(x): \n            """Return max earning at x."""\n            if x == n: return 0 \n            ans = fn(x+1)\n            for xx, tip in mp.get(x, []): \n                ans = max(ans, xx - x + tip + fn(xx))\n            return ans \n        \n        return fn(1)\n```\n\n**bottom-up**\n```\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:\n        mp = {}\n        for start, end, tip in rides: \n            mp.setdefault(start, []).append((end, tip))\n        \n        dp = [0]*(n+1)\n        for x in range(n-1, 0, -1): \n            dp[x] = dp[x+1]\n            for xx, tip in mp.get(x, []): \n                dp[x] = max(dp[x], xx - x + tip + dp[xx])\n        return dp[1]\n```
['Python3']