[刷题]Best Time to Buy and Sell Stock II
来源:互联网 发布:北京程序员 编辑:程序博客网 时间:2024/06/05 00:57
[LintCode]Best Time to Buy and Sell Stock II
class Solution { /** * @param prices: Given an integer array * @return: Maximum profit */ public int maxProfit(int[] prices) { // 2015-09-15 if (prices == null || prices.length == 0) { return 0; } int rst = 0; for (int i = 1; i < prices.length; i++) { int sub = prices[i] - prices[i - 1]; if (sub > 0) { rst += sub; } } return rst; }};
0 0
- [刷题]Best Time to Buy and Sell Stock II
- [LeetCode]Best Time to Buy and Sell Stock II
- LeetCode Best Time to Buy and Sell Stock II
- Leetcode: Best Time to Buy and Sell Stock II
- [Leetcode] Best Time to Buy and Sell Stock II
- Best Time to Buy and Sell Stock II
- LeetCode : Best Time to Buy and Sell Stock II
- LeetCode Best Time to Buy and Sell Stock II
- [LeetCode] Best Time to Buy and Sell Stock II
- leetcode 61: Best Time to Buy and Sell Stock II
- [LeetCode] Best time to buy and sell a stock II
- Best Time to Buy and Sell Stock II
- Best Time to Buy and Sell Stock II
- 【leetcode】Best Time to Buy and Sell Stock II
- LeetCode - Best Time to Buy and Sell Stock II
- Best Time to Buy and Sell Stock II
- Best Time to Buy and Sell Stock II
- LeetCode之Best Time to Buy and Sell Stock II
- Maximal Rectangle
- ARM9 ADS8344 SPI驱动移植 (三)
- Best Time to Buy and Sell Stock III
- java学习之BigInteger类、BigDecimal类
- ASP.NET在主题中添加CSS文件
- [刷题]Best Time to Buy and Sell Stock II
- CountDownLatch和CyclicBarrier的应用场景
- linux文件搜索命令-2
- nmake命令(windows下的makefile)
- eos入门笔记(nui版本)(一)
- CGRectMake & CGSizeMake
- Error:A problem occurred configuring project ':app'. > failed to find Build
- 抽象类和接口的区别
- Helloworld