Question: Question 3 (6 points) Suppose that you are able to predict the future and you know what the price of a particular stock will be

Question 3 (6 points) Suppose that you are able to predict the future and you know what the price of a particular stock will be on n different days. You have stored this information in an array S[1 ... n). You would like to choose exactly one day on which to buy the stock and exactly one (later) day on which to sell the stock, with the goal of maximizing your profit. In other words, you want to choose a and b (with a
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
