Here’s the problem statement: GIven an array of integers that represent the worth of stock on consecutive days, find the maximum profit that can be made by buying stock on any day and then selling it on another day in the future. You are allowed multiple buy-sell transactions. However, you cannot both buy and sellContinue reading “Scribble 14: Maximize Profit Part 2”
Tag Archives: Maximize Profit
Scribble 13: Maximize Profit
This is a really interesting problem. Here’s the problem statement: Given an array of integers that represents the worth of stock on consecutive days, find the maximum profit that can be earned by buying stock on any day and then selling it on another day in the future. For example: The Array: [9,1,5,4,6,2]Output: 5 (buyContinue reading “Scribble 13: Maximize Profit”