1 import java.math.BigInteger; 2 import
java.util.*; 3 public class Main { 4 public static void main(String []args) 5 {
6 Scanner cin...
分类:
其他好文 时间:
2014-06-07 05:07:21
阅读次数:
222
Problem Description:
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 complete at most two transa...
分类:
其他好文 时间:
2014-06-05 09:33:52
阅读次数:
342
Say you have an array for which theithelement
is the price of a given stock on dayi.If you were only permitted to complete at
most one transaction (ie...
分类:
其他好文 时间:
2014-05-30 16:30:00
阅读次数:
282
Say you have an array for which theithelement
is the price of a given stock on dayi.Design an algorithm to find the maximum
profit. You may complete a...
分类:
其他好文 时间:
2014-05-30 16:19:05
阅读次数:
320
Say you have an array for which theithelement
is the price of a given stock on dayi.Design an algorithm to find the maximum
profit. You may complete a...
分类:
其他好文 时间:
2014-05-30 15:00:54
阅读次数:
335
class Solution {public: int maxProfit(vector
&prices) { if(prices.size() == 0) return 0; vector f1(prices.size()); int
minV = pri...
分类:
其他好文 时间:
2014-05-30 02:54:28
阅读次数:
231
class Solution {public: int maxProfit(vector
&prices) { if(prices.size() == 0) return 0; vector f(prices.size()); f[0] =
0; ...
分类:
其他好文 时间:
2014-05-30 02:46:12
阅读次数:
318
My original thought was to calculate all the
possible transactions by using nested loop. But got time limit excess error.I
knew it can be done in O(n)...
分类:
其他好文 时间:
2014-05-29 20:44:37
阅读次数:
271
一次过,思路是:最大收益可以由所有上升序列差价叠加中获得 1 public class
Solution { 2 public int maxProfit(int[] prices) { 3 int profit = 0; 4 if
(prices.lengt...
分类:
其他好文 时间:
2014-05-29 20:43:33
阅读次数:
254
题目: 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...
分类:
其他好文 时间:
2014-05-28 22:37:18
阅读次数:
327