Your algorithms have become so good at predicting the market that you now know what the share price of a company say AAC will be for the next number of days.
Each day, you can either buy one share of AAC, sell any number of shares of AAC that you own, or not make any transaction at all. What is the maximum profit you can obtain with an optimum trading strategy? Write a method to calculate this as shown;
Example Prices = [1,2]; Buy one share day one, and sell it day two for a profit of 1. Return 1. Prices = [2,1]; No profit can be made so you do not buy or sell stock those days. Return 0.
