HNHacker News
TopNewBestAskShowJobs

afffffffffa

2 karma · joined July 6, 2020

submissionscomments
afffffffffa··on Buying and Selling stocks with maximum profit
Apologies, thanks for clarifying.

There is a small typo which I think caused me some trouble parsing the sentence. In hindsight however the problem definition seems clear.

afffffffffa··on Buying and Selling stocks with maximum profit
The page claims

>[7, 3, 13, 13, 6, 19, 10, 8, 15, 18]

>the maximum profit that can be made is 26 which is made as

>follows:

>Buy at 3 – Sell at 19, Buy at 8 – Sell at 18

However wouldn't profit be maximized with

B3, S13, B6, S19, B8, S18 for a total of profit of 33?