Given an array of integers, find two numbers such
that they add up to a specific target number.The function twoSum should return
indices of the two nu...
分类:
其他好文 时间:
2014-05-26 19:50:39
阅读次数:
314
import
reex=raw_input()num="1234567890"a=re.findall("\d+",ex)b=re.findall("[+-]",ex)l=[]if
len(a)==len(b): for i in range(len(a)): l.append(...
分类:
其他好文 时间:
2014-05-26 01:47:32
阅读次数:
296
add two numbers without arithmetic
分类:
其他好文 时间:
2014-05-26 01:25:43
阅读次数:
224
1.RMQ问题
RMQ (Range Minimum/Maximum Query):对于长度为n的数组A,回答若干询问RMQ(A,i,j)(i,jRMQ问题是指求区间最值的问题。最简单的方法,就是遍历数组直接搜索,但是这种方式时间复杂度是O(n)。对于数组长度较大,性能要求高的场景不适用。
2.ST(Sparse Table)算法
ST算法是一种更加高效的算法,以O(nlog...
分类:
其他好文 时间:
2014-05-25 22:28:29
阅读次数:
375
You are given two linked lists representing two non-negative numbers. The digits are
stored in reverse order and each of their nodes contain a single digit. Add the two numbers
and return i...
分类:
其他好文 时间:
2014-05-25 21:36:52
阅读次数:
268
Graphic SequenceA graphic sequence is a
sequence of numbers which can be thedegree sequenceof somegraph. A sequence can
be checked to determine if it ...
分类:
其他好文 时间:
2014-05-25 19:18:00
阅读次数:
331
筛素数,分解质因子 1 //Accepted 620 KB 15 ms 2 //wa1 MAXN
太小了一开始用的10005; 3 //wa2 没判断素数 4 //wa3 分解质因子用的小于n 5 #include 6 #include 7 const
int MAXN = 1000...
分类:
其他好文 时间:
2014-05-25 14:52:12
阅读次数:
168
h=lambda t:(reduce(lambda x,y:x*y,range(1,t+1)))
h(5)=120
reduce函数是一个二元操作函数,他用来将一个数据集合(链表,元组等)中的所有数据进行下列操作:用传给reduce中的函数 func()(必须是一个二元操作函数)先对集合中的第1,2个数据进行操作,得到的结果再与第三个数据用func()函数运算,最后得到一个结果。...
分类:
编程语言 时间:
2014-05-25 09:55:21
阅读次数:
477
Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n.
The cost of the i-th stone is vi.
Kuriyama Mirai wants to know something about these sto...
分类:
其他好文 时间:
2014-05-25 07:24:48
阅读次数:
315
Irange =
(Microsoft.Office.Interop.Excel.Range)worksheet.get_Range("I1",
"I1").get_Resize(100, 1);//获取一整列I,行数为100Irange.Validation.Add(Microsoft.Offic...
分类:
其他好文 时间:
2014-05-25 02:21:42
阅读次数:
293