Skip to content

Latest commit

 

History

History

121_best_time_to_buy_and_sell_stock

###121. Best Time to Buy and Sell Stock 简单动态规划问题

###Contents

Say you have an array for which the ith element is the price of a given stock on day i.

If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.

###Difficulty Easy

###Tags Array, Dynamic Programming

###Similar Problems (H) Best Time to Buy and Sell Stock IV, (M) Best Time to Buy and Sell Stock II, (M) Best Time to Buy and Sell Stock with Cooldown, (M) Maximum Subarray, (H) Best Time to Buy and Sell Stock III