...

>

Best Time to Buy and Sell Stock

Best Time to Buy and Sell Stock

Try to solve the Best Time to Buy and Sell Stock problem.

Statement

Given an array, prices, where prices[i] represent the price of a stock on the i-th day, maximize profit by selecting a single day to buy the stock and a different day in the future to ...