improve the solution of BestTimeToBuyAndSellStock3