[Python] Solution - Maximum Earnings from Taxi
\nProblem :  To find the maximum earnings.\n\nIdea : Start to think in this way that we can track the maximum earning at each point .\neg : n = 20, rides = [[1,
\n**Problem** :  To find the maximum earnings.\n\n**Idea** : Start to think in this way that we can track the maximum earning at each point .\neg : n = 20, rides = [[1,6,1],[3,10,2],[10,12,3],[11,12,2],[12,15,2],[13,18,1]]\n\nWe want to loop from i =  1 to n and at each step check if this i is an end point or not .\nif it is an end point then we check all of its corresponding start points and get the maximum earning we can make .\n\n i   | 0 | 1 | 2 | 3 | 4 | 5\ndp| 0 | 0 | 0 | 0 | 0 | 0\n\nWhen i=6 ,\nwe check if 6 is an end point in the given array of rides \nyes it is \n(Note : -In order to quickly check if this number is an end point or not I am maintaining a dictionary where \nkey=end point and the value is [start_point,tip])\n\nnow I loop through all the corresponding start points whose end point is i\ntemp_profit = i(end_point) - start_point + tip \nbut in order to get the total profit at this end point (i) I also have to consider adding dp[start_point]\n\nWhat this means is   **max_profit achieved till the start point (i.e dp[start])+ profit achieved from start_point to this end_point(i)\n(i.e end_point(i)-start_point+tip)**\n\nHence the eqn : \n****\n dp[i] = max(dp[i-1],end_point-start_point+tip+dp[start])\n****\n\nSolution :\n\n```\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:\n        \n        d = {}\n        for start,end,tip in rides:\n            if end not in d:\n                d[end] =[[start,tip]]\n            else:\n                d[end].append([start,tip])\n        \n       \n        dp = [0]*(n+1)\n        dp[0] = 0\n        \n        for i in range(1,n+1):\n            dp[i] = dp[i-1]\n            if i in d:\n                temp_profit = 0\n                for start,tip in d[i]:\n                    if (i-start)+tip+dp[start] > temp_profit:\n                        temp_profit = i-start+tip+dp[start]\n                dp[i] = max(dp[i],temp_profit)\n                \n                \n        return dp[-1]\n```\nT.C : O(n)\n
['Dynamic Programming', 'Python', 'Python3']