Back to problems

Stock Trading Profit Calculator

Algorithm · Amazon · Medium

Stock Trading Profit Calculator Medium · Array, Dynamic Programming · Company Tags · Hints Suppose you have a historical record of daily stock prices for a particular company, stored in an array prices of size n. prices[i] tells you the price of one share on day i. You are given a trading mode flag mode and a transaction fee fee. Your goal is to determine the maximum profit you can earn by buying and selling shares according to the rules described below. If mode = 1, you are…

Checking your access…