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-07-07 08:19:36
阅读次数:
151
url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址。type: 要求为String类型的参数,请求方式(post或get)默认为get。注意其他http请求方法,例如put和 delete也可以使用,但仅部分浏览器支持。timeout: 要求为Number类型的参数,设置请求...
分类:
其他好文 时间:
2014-07-05 19:15:26
阅读次数:
179
今天看JS学习资料,看到一个toString()方法,在JS中,定义的所有对象都具有toString()方法。Number类型的toString()方法比较特殊,有默认模式和基模式两种。默认模式的例子:var num1 = 10;var num2 = 10.0;alert(num1.toString...
分类:
Web程序 时间:
2014-07-05 18:03:26
阅读次数:
266
row_number() OVER (PARTITION BY COL1 ORDER BY COL2)
--表示根据COL1分组,在分组内部根据 COL2排序,而此函数返回的值就表示每组内部排序后的顺序编号(组内连续的唯一的)
例子一: create table student (id int ,classes int ,score int);
insert into student val...
分类:
其他好文 时间:
2014-07-03 18:33:50
阅读次数:
213
题目连接:uva 10622 - Perfect P-th Powers
题目大意:对于x,如果存在最大的p,使得有整数满足x=bp,则称x为perfect
pth power。现在给出x,求p。
解题思路:将x分解质因子,所有置因子的个数的最大公约数即为所求p,需要注意的是x为负数的时候,p必须为奇数。
#include
#include
#include
const...
分类:
其他好文 时间:
2014-07-03 16:56:13
阅读次数:
233
SPOJ Problem Set (classical)
694. Distinct Substrings
Problem code: DISUBSTR
Given a string, we need to find the total number of its distinct substrings.
Input
T- number of ...
分类:
其他好文 时间:
2014-07-03 16:32:42
阅读次数:
212
选择排序
定义:依次选择最小的元素放在相应的位置上
特点:比较次数是 N(N-1)/2 交换次数是 N (each exchange puts an item into its ?nal position, so the number of exchanges is N. Thus, the running time is dominated by the number of
com...
分类:
其他好文 时间:
2014-07-03 15:44:01
阅读次数:
259
Given a binary tree, find its maximum depth.
分类:
其他好文 时间:
2014-07-03 13:19:33
阅读次数:
251
Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig...
分类:
其他好文 时间:
2014-07-03 13:05:28
阅读次数:
210
DECLARE@dtdatetimeSET@dt=GETDATE()DECLARE@numberintSET@number=3--1.指定日期该年的第一天或最后一天--A. 年的第一天SELECTCONVERT(char(5),@dt,120)+'1-1'--B. 年的最后一天SELECTCONVE...
分类:
其他好文 时间:
2014-07-03 12:18:49
阅读次数:
201