Lintcode:买卖股票的最佳时机
来源:互联网 发布:ubuntu arm linux gcc 编辑:程序博客网 时间:2024/04/28 20:54
Lintcode:买卖股票的最佳时机
class Solution: """ @param prices: Given an integer array @return: Maximum profit """ def maxProfit(self, prices): # write your code here if(len(prices)==0): return 0 lowest_price = prices[0] ans = 0 for i in range(len(prices)): ans = max(ans, prices[i]-lowest_price) lowest_price = min(prices[i], lowest_price) return ans
0 0
- LintCode-买卖股票的最佳时机
- LintCode--买卖股票的最佳时机
- Lintcode:买卖股票的最佳时机
- 买卖股票的最佳时机,lintcode
- 【LintCode】买卖股票的最佳时机
- lintcode--买卖股票的最佳时机
- Lintcode 买卖股票的最佳时机
- 买卖股票的最佳时机-LintCode
- LintCode--买卖股票的最佳时机 II
- lintcode-买卖股票的最佳时机-149
- lintcode-买卖股票的最佳时机II-150
- LintCode:买卖股票的最佳时机 II
- LintCode:买卖股票的最佳时机 III
- Lintcode 买卖股票的最佳时机 II
- LintCode 151 买卖股票的最佳时机 III
- LintCode 152 买卖股票的最佳时机 IV
- lintcode--买卖股票的最佳时机II
- 买卖股票的最佳时机 II-LintCode
- Windows下react-native安装步骤以及安装时候遇到各类已填平的坑
- 升级JDK版本后,SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializ
- leetcode [python] 【338】Counting Bits
- php对XML的解析
- 7.2 LOCAL_STATE:virtual模块核心结构体
- Lintcode:买卖股票的最佳时机
- unsigned 相减
- MySQL- 'load data infile'语句
- sqlserver查找包含关键词的视图
- linux下配置JDK JAVA环境
- Android SoundPool播放实例和方法详解
- 剑指Offer——把字符串前面的n个字符转移到字符串的尾部
- [LeetCode]22. Generate Parentheses
- C++第三次上机实验,计算利息问题