← 返回 amazon 的题目列表Best Time to Buy and Sell Stock
类型:online_judge
Given an array of integers where each element represents the stock price on a given day, design an algorithm to find the maximum profit you can achieve from one transaction (buy and sell one share of the stock). Note that you cannot sell a stock before you buy one.
Example
Input
[7,1,5,3,6,4]