Simplest C# Solution
Approach\nSimply tack the min price of the stock and the profit. \n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity: O(n)\n A
# Approach\nSimply tack the min price of the stock and the profit. \n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\npublic class Solution {\n    public int MaxProfit(int[] prices) {\n        var min = prices[0];\n        var profit = 0;\n        foreach (var today in prices) {\n            profit = Math.Max(profit, today-min);\n            min = Math.Min(min, today);\n        }\n        return profit;\n    }\n}\n```
['C#']