← ALL NOTES
Array

123. Best Time to Buy and Sell Stock III

At most two non-overlapping transactions, so treat each day i as a dividing line: the best single transaction within [0..i] plus the best single transaction within [i..n-1]. Maximize that sum over…

Loading…