Leetcode Best Time to Buy and Sell Stock II
2015-07-04 17:11
211 查看
class Solution:
# @param {integer[]} prices
# @return {integer}
def maxProfit(self, prices):
profit = 0;
for i in xrange(1, len(prices)):
if prices[i] > prices[i-1]:
profit += prices[i] - prices[i-1]
return profit
# @param {integer[]} prices
# @return {integer}
def maxProfit(self, prices):
profit = 0;
for i in xrange(1, len(prices)):
if prices[i] > prices[i-1]:
profit += prices[i] - prices[i-1]
return profit
相关文章推荐
- Web项目中web.xml 中的listener、 filter、servlet 加载顺序
- 有道词典
- Leetcode 121 Best Time to Buy and Sell Stock
- Intent数据传递(转)
- c语言函数指针的理解与使用
- POJ 3253 Fence Repair
- 一起talk GDB吧(第三回:GDB断点调试)
- 黑红五子棋之人人对弈
- cryptsetup文件系统加密
- linux中Shell标准输出错误 >/dev/null 2>&1 分析
- Leetcode 221 Maximal Square
- 叫号系统排队系统挂号系统实现
- RelativeLayout里的gravity不能居中的解决方法
- 关于Cookie的有关内容
- J.U.C JMM. pipeline.指令重排序,happen-before
- [JavaEE] JBoss主要版本下载链接一览
- mysql 错误号1130
- Leetcode 70 Climbing Stairs
- 利用ns2仿真MANET中的虫洞攻击
- 开始玩hadoop7--hadoop 2.6.0 在eclipse里安装(第一个map程序)