← 返回 citadel 的题目列表Best Time to Buy and Sell Stock
类型:online_judge
Given an array prices where prices[i] is the price of a given stock on the i-th day, you want to maximize your profit by choosing a day to buy one stock and choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.
Example
Input
[7,1,5,3,6,4]
Output
5