123. Best Time to Buy and Sell Stock III

188.IV的一个特例,k=2;

public class Solution {
    public int maxProfit(int[] prices) {
        if (prices == null || prices.length ==0)
            return 0;
        int len = prices.length;
        int dp[][] = new int[3][len];
        
        for (int i=1; i<=2; i++) {
            int max_tmp = dp[i-1][0] - prices[0];
            for (int j=1; j

你可能感兴趣的:(123. Best Time to Buy and Sell Stock III)