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-08-14 23:05:56
阅读次数:
165
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2014-08-14 20:20:09
阅读次数:
206
题目链接:点击打开链接
题意:
第一行 n m
n个vector
下面n行 第一个数字u表示vector 的大小,然后后面u个数字给出这个vector
最后一行m个数字
表示把上面的vector拼接起来
得到一个大序列,求这个大序列的最大子段和
先预处理出每个vector的最大子段和,左起连续最大,右起连续最大,所有数的和
然后dp 一下。。
#include ...
分类:
其他好文 时间:
2014-08-13 18:55:07
阅读次数:
266
设计模式-使用php实现工厂方法模式【概要】创建型模式定义一个用于创建对象的接口,让子类决定实例化哪一个类。Factory Method使用一个类的实例化延迟到其子类【GOF95】【结构图】【主要角色】抽象产品(Product)角色:详细产品对象共同拥有的父类或接口详细产品(Concrete Pro...
分类:
Web程序 时间:
2014-08-13 18:35:56
阅读次数:
277
使用rman复制数据库原数据库sidorcl复制新的数据库sid为nylg1.创建复制备份数据库的参数文件在原数据库创建pfilecreatepfilefromspfile;然后复制pfile参数文件[oracle@Nagiostestdbs]$pwd/u01/app/oracle/product/11.2/dbs[oracle@Nagiostestdbs]$cpinitorcl.orainitnylg.ora修..
分类:
数据库 时间:
2014-08-13 15:18:17
阅读次数:
293
思路:从左向右遍历数组元素相加求和得到和sum,若sum小于0,必然会对总的和有损耗,因此将sum重置为0,从当前位置继续重复上述过程,直到数组结束,与此同时设置max变量记录求和过程中遇到的最大值。
执行完上述过程,判断max等于0(max初值为0),若大于0,max为所求结果,返回max。
若仍然等于0说明求和过程中未出现过正数,数组中全是负数或0,此时数组最大和就是数组中最大的最...
分类:
其他好文 时间:
2014-08-13 15:01:56
阅读次数:
211
Description
YH gave Qz an odd matrix consists of one or zero. He asked Qz to find a square that has the largest area. The problem is not so easy, that means the square you find must not contai...
分类:
其他好文 时间:
2014-08-12 19:11:04
阅读次数:
208
1、定义 工厂方法模式定义了一个创建对象的接口,但由子类决定要实例化的类是哪一个。工厂方法让类把实例化推迟到子类。 2、类图 在工厂方法模式中,抽象产品类Product负责定义产品的共性,实现对事物最抽象的定义;Creator为抽象创建类,也就是抽象工厂,具体如何创建产品类是由具体的实现工厂Conc...
分类:
其他好文 时间:
2014-08-12 16:52:04
阅读次数:
235
1 /* 2 item.jd.com Compressed by uglify 3 Author:keelii 4 Date: 2014-08-05 6:52:26 [PM] 5 */ 6 function insertScript(t, e) { 7 ...
分类:
Web程序 时间:
2014-08-12 03:07:03
阅读次数:
490
A secret service developed a new kind of explosive that attain its volatile property only when a specicassociation of products occurs. Each product i...
分类:
其他好文 时间:
2014-08-12 00:23:43
阅读次数:
228