Better version of Best Time to Buy and Sell Stock II