Python實現"買賣股票的最佳時機"的一種方法

 給定一個數組,該數組中第i個元素是某個股票第i天的價錢html 若是最多隻能完成一次交易(買入股票,賣出股票),設計一個算法,能夠得到最大的利潤python 注意:在你買入股票以前不能賣出股票算法 Example 1:數組 Input: [7,1,5,3,6,4] Output: 5 Explanation: Buy on day 2 (price = 1) and sell on day 5
相關文章
相關標籤/搜索