Best Time to Buy and Sell Stock I
只能作一次操作时:维护preMin记录之前出现的最小值
代码如下:
int maxProfit(vector &prices) {
if (prices.size() == 0) return 0;
int profit = 0;
int preMin = prices...
分类:
其他好文 时间:
2014-10-10 00:02:08
阅读次数:
204
题意:一些机枪彼此不能在同一行和同一列,但是由于有墙的阻隔,能保证子弹无法穿透,即可以同行同列,现问如果说给了一个n*n(n#include using namespace std;int n,best;char map[4][4];int canput(int row,int col){ int....
分类:
其他好文 时间:
2014-10-09 22:10:47
阅读次数:
233
Let's dance in style让我们翩然起舞Let's dance for a while让我们尽情欢笑Heaven can wait天堂也得等著我们We're only watching the skies我们只是仰望凝视著天空Hoping for the best愿望有最好的结果But...
分类:
其他好文 时间:
2014-10-09 21:44:07
阅读次数:
178
同事问了一个非常简单的问题,怎么取出每个partition里面另外一个列的最小值? create table t1 (int c1, int c2); 假如按照c2分区,0-10,10-20,20-30,30-40,40-50 insert into t1 values(101, 1);
inser...
分类:
其他好文 时间:
2014-10-09 18:27:57
阅读次数:
153
/**
* 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
* ...
分类:
其他好文 时间:
2014-10-07 11:10:03
阅读次数:
129
原题地址:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/题意:Say you have an array for which theithelement is the price of a given sto...
分类:
编程语言 时间:
2014-10-06 23:54:02
阅读次数:
266
Alpha是图形界面开发中常用的特效,通常我们会使用以下代码来实现Alpha特效:view.setAlpha(0.5f);View.ALPHA.set(view, 0.5f);ObjectAnimator.ofFloat(view, "alpha", 0.5f).start();view.anima...
分类:
其他好文 时间:
2014-10-06 17:55:30
阅读次数:
160
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 complet...
分类:
其他好文 时间:
2014-10-06 14:52:50
阅读次数:
220
First of all, you should install a clean Ubuntu Server (Amd-64) on your server. (Version 14.04 is strongly recommended for the best compatibility)Get ...
分类:
其他好文 时间:
2014-10-06 13:56:40
阅读次数:
187
You’re excited; your client is excited. All is well. You’ve just launched the client’slatest website, and it’s fantastic. You’ve put in hours of sweat...
分类:
Web程序 时间:
2014-10-05 14:33:28
阅读次数:
290