← 返回 microsoft 的题目列表Best Time to Buy and Sell Stock
类型:online_judge
Given an array where the i-th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most one transaction (i.e., buy one and sell one share of the stock).
Example
Input
[7, 1, 5, 3, 6, 4]