simple python solution | faster than 92.61% | with comments
O(n + k * log(k)) where k == len(rides)\n\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:\n        ans = [0 for i in ran
O(n + k * log(k)) where k == len(rides)\n```\nclass Solution:\n    def maxTaxiEarnings(self, n: int, rides: List[List[int]]) -> int:\n        ans = [0 for i in range(n + 1)] #storage for answer on each point\n        end = 0\n        \n        for p in sorted(rides, key = lambda x: x[1]): #sort list by ends of rides in ascending order\n            for i in range(end + 1, p[1]): ans[i] = ans[i - 1] #set maximum earning for points from last end until the end of current ride\n            s = p[1] - p[0] + p[2] + ans[p[0]] #calculate earning, in ans[p[0]] we have maximum earning in the start of current ride\n            ans[p[1]] = max(ans[p[1]], ans[p[1] - 1], s) #ans[p[1]] is included for cases when the last end is equal to current\n\t\t\tend = p[1]\n        \n        return ans[end]\n\n```\n![image](https://assets.leetcode.com/users/images/731ef560-83fd-466d-adb7-ef22ef195463_1635526428.6964653.png)\n
['Dynamic Programming', 'Sorting', 'Python']