Question: 3 . 2 N Days ( 2 0 pt . ) Now, suppose you are given prices over n days. Using your solution to part
N Days pt
Now, suppose you are given prices over n days. Using your solution to part a as a guide, design an OnkQ time algorithm that determines whether you can reach your goal, and if not, reports the maximum profit achievable. Prove your algorithms runtime and correctness.
Hint: Its helpful to reframe each day as selling all the shares you own and then buying a set of shares that you can afford.
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
