programming icon indicating copy to clipboard operation
programming copied to clipboard

Gives a solution to the problem of Peaks and Valleys in C++

Open theopaid opened this issue 6 years ago • 0 comments

Buying and selling stocks gets optimized for maximum profit.

The key point is we need to consider every peak immediately following a valley to maximize the profit. In case we skip one of the peaks (trying to obtain more profit), we will end up losing the profit over one of the transactions leading to an overall lesser profit. #HacktoberFest

theopaid avatar Sep 27 '20 19:09 theopaid