122. Best Time to Buy and Sell Stock II
来源:互联网 发布:linux存储服务器有哪些 编辑:程序博客网 时间:2024/05/16 04:34
解法一:
public class Solution { public int maxProfit(int[] prices) { if (prices.length<2) return 0; int sumProfit = 0,startIndex = 0; for (int i = 1; i < prices.length; i++) {if (prices[i]>prices[i-1]) {sumProfit = sumProfit+prices[i]-prices[i-1];}} return sumProfit; }}
0 0
- 122. Best Time to Buy and Sell Stock II
- LeetCode 122. Best Time to Buy and Sell Stock II
- 122.Best Time to Buy and Sell Stock II
- [Leetcode] 122. Best Time to Buy and Sell Stock II
- [leetcode] 122.Best Time to Buy and Sell Stock II
- 【leetcode】122.Best Time to Buy and Sell Stock II
- 122. Best Time to Buy and Sell Stock II
- 【LeetCode】122.Best Time to Buy and Sell Stock II
- [leetcode] 122. Best Time to Buy and Sell Stock II
- LeetCode #122. Best Time to Buy and Sell Stock II
- 122. Best Time to Buy and Sell Stock II LeetCode
- 122. Best Time to Buy and Sell Stock II
- 122. Best Time to Buy and Sell Stock II
- 122. Best Time to Buy and Sell Stock II
- [LeetCode]122. Best Time to Buy and Sell Stock II
- 122. Best Time to Buy and Sell Stock II
- Leetcode 122. Best Time to Buy and Sell Stock II
- leetcode 122. Best Time to Buy and Sell Stock II
- 二进制转换及位运算
- (转)内部类详解
- Android中的Toast的标准格式和自定义格式
- Android开发中在一个Activity中关闭另一个Activity
- Qt中使用ActiveX(三)【ActiveX在网页中的使用】
- 122. Best Time to Buy and Sell Stock II
- 将MySQL数据迁移到Redis
- 产品经理,不要成为作图经理
- Winform部分控件的使用技巧
- 1042. Shuffling Machine (20)
- 做一个快乐的技术型销售
- Repast仿真学习
- tomcat集群实现源码级别剖析
- 用于Android开的简易WebService访问框架