← 返回 capitalone 的题目列表Maximize Stock Return
类型:online_judge
Given a list of floats representing stock prices, where index 0 is the price on day 1, and index n is the price on day n+1. You can only buy and sell once, and cannot trade on the same day. Calculate the maximum return.
Example Input
7.0, 1.5, 5.3, 3.2, 6.4, 4.8
Example Output
5.0
Constraints
The length of input list does not exceed $10^5$
Each price is a float, accurate to two decimal places
Example
Input
7.0 1.5 5.3 3.2 6.4 4.8