Python_Beginner: Simple Solution
If the code helped, would appreciate an upvote.\n\'\'\'\nclass Solution:\n    \n\tdef maxProfit(self, prices: List[int]) -> int:\n\t\t\n\t\tif not prices:\n    
If the code helped, would appreciate an upvote.\n\'\'\'\nclass Solution:\n    \n\tdef maxProfit(self, prices: List[int]) -> int:\n\t\t\n\t\tif not prices:\n            return 0\n\n        profit = 0\n\n        buy_stock = prices[0]\n\n        for i in range(len(prices)):\n\n            # update the buy_stock if there\'s\n            # any smaller value is present in the list\n            if buy_stock > prices[i]:\n                buy_stock = prices[i]\n\n            # Now we\'ve buy_stock.\n            # Calculate the max of price diff and profit made till now\n            profit = max((prices[i] - buy_stock, profit))\n\n        return profit
['Python3']