Maximize Stock profit when array of stock prices are given