Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction ...
分类:
其他好文 时间:
2017-11-20 14:30:55
阅读次数:
124
用户没登陆:购物车添加到Cookie中用户登陆: 保存购物车到Redis中 (不用数据库)整体的思路图解:接下来就是代码实例来实现 购物车的功能了:首先我们看下购物车和购物项两个JavaBean的设计:购物车: buyerCart.java 这里使用了@JsonIgonre注解是因为下面需要将Buy ...
分类:
其他好文 时间:
2017-11-16 18:45:13
阅读次数:
120
题目描述: On his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some strange ...
分类:
其他好文 时间:
2017-11-16 11:51:18
阅读次数:
171
class Solution {public: int maxProfit(vector<int>& prices) { int maxCur = 0, maxAll = 0; if(prices.size() <= 1) return 0; auto i = prices.begin(); ++i ...
分类:
其他好文 时间:
2017-11-12 17:32:33
阅读次数:
99
As we mentioned last week, the Chinese government requires all company and individuals to buy social insurance, including foreigners. Why are foreigne ...
分类:
其他好文 时间:
2017-11-06 16:48:50
阅读次数:
320
题目: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may co ...
分类:
编程语言 时间:
2017-11-04 13:33:47
阅读次数:
235
/* 找一次操作能获取最大利润的一次交易(即题目121)的idxBuy和idxSell,这次交易称为首次交易 然后分5中情况: 情况1:最优解就只有“首次交易” 情况2:“首次交易”加上左边的交易得到最优解 情况3:“首次交易”加上右边的交易得到最优解 情况4:“首次交易”不做,两边的交易得到最优解... ...
分类:
其他好文 时间:
2017-11-03 18:53:04
阅读次数:
118
122. Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to ...
分类:
编程语言 时间:
2017-10-29 20:18:35
阅读次数:
184
// Best Time to Buy and Sell Stock 1class Solution { public: int maxProfit(vector& prices) { if(prices.size()==0) return 0; int maxres=prices[prices.s... ...
分类:
其他好文 时间:
2017-10-29 17:31:51
阅读次数:
142