Buy stock to get max profit with at most K times
This is from leetcode, Best Time to Buy and Sell Stock IV. Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most k transactions. The answer is to use dynamic programming by local and global 2-dimension array to implement… Read More »