Solved BestTimeToBuySell-II in java