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 (ie, buy one and sell one share of the stock),...
分类:
其他好文 时间:
2015-01-15 09:30:17
阅读次数:
172
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 as many transactions as you like (ie, buy on...
分类:
其他好文 时间:
2015-01-15 09:27:56
阅读次数:
187
需求:股民买卖股票初步代码:# -*- encoding: utf-8 -*-#股票1class Stock1 def buy puts '股票1买入' end def sell puts '股票1卖出' endend#股票2class S...
分类:
其他好文 时间:
2015-01-14 22:43:20
阅读次数:
177
只有每次看这个图的时候才觉得c++没有白学啊~~~平常用vs的时候都各种怀念eclipse,各种怀念java~~~ 这题算的是最大利润,原先我想的是找到最小值和最大值,之差不就是最大利润了么,后来想想,最小值可能在最大值之后,不能说在3号买进了回去1号卖出股票哈~然后想,记录某天之前的最小值,再记录...
分类:
其他好文 时间:
2015-01-14 19:39:12
阅读次数:
151
这大家可以这么想
一共有50瓶,
喝完三瓶 + 1
喝完三瓶 + 1
那么 50 - 3 + 1 -3 + 1
以此类推知道。。。最后剩余的可乐数小于3退出。那么依旧题意可以写出。
package cccc;
public class Buy {
public static void main(String[] args) {
int number = 50; /...
分类:
其他好文 时间:
2015-01-13 19:50:47
阅读次数:
795
https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/Say you have an array for which theithelement is the price of a given stock on day...
分类:
其他好文 时间:
2015-01-13 14:14:12
阅读次数:
100
https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/Say you have an array for which theithelement is the price of a given stock on dayi.I...
分类:
其他好文 时间:
2015-01-13 14:08:51
阅读次数:
132
Hello Guys, it's time to take an hypothetical question in Javarevisited. Which programming book, would you love to buy, if you are given 100$ to spend...
分类:
其他好文 时间:
2015-01-13 06:40:53
阅读次数:
169
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...
分类:
其他好文 时间:
2015-01-12 14:17:39
阅读次数:
207