Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Consider the first K stock prices. At the end, the only legal states are that you don't own a share of stock, or that you do. Calculate the most profit you could have under each of these two cases.