Stock Market Max Profit
For this week I did a problem called maxProfit. I found that this problem was actually a bit more practical for real life. The problem is that you are given a list containing integers that represent the price of a stock at a certain day. For example a list of [4,3,2,6,8,1,18,3,5,7]. For example at index 0 the stock was at 4 dollars and index 1 the price was 3 dollars. We would want to buy the stock at the lowest price possible and sell the stock at the highest price possible. For example in this case we would want to buy at price 1 and sell at price 18. We take the difference of that and our profit would be 17. At first I thought right away of going to a double for loop and taking the difference at every step and seeing if that was the max profit. I however have been reading about big o(N) notation and that would not be optimal. That would be O(N^2). I thought about a faster solution where would would just go through the list once and have a O(N) time. The way we accomplish