这一节,我们将主要学习用于list的三个内建函数:filter(),map(), 和reduce().1.filter(function,sequence) 逐个从sequence中取一个元素,传入function,返回一个使function为真的序列。 如果参数sequence是str、unico...
分类:
编程语言 时间:
2015-04-07 11:37:39
阅读次数:
210
A sequence of numbers
http://acm.hdu.edu.cn/showproblem.php?pid=2817
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4046 Accepted Subm...
分类:
其他好文 时间:
2015-04-07 10:02:41
阅读次数:
193
Boring Counting
Time Limit: 3000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
In this problem you are given a number sequence P consisting of N integer and Pi is the ith element in the sequence. No...
分类:
编程语言 时间:
2015-04-07 09:58:52
阅读次数:
146
Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters (including the e...
分类:
其他好文 时间:
2015-04-07 07:09:42
阅读次数:
441
题目:
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, given
s = “leetcode”,
dict = [“leet...
分类:
其他好文 时间:
2015-04-06 21:53:21
阅读次数:
163
线段树的应用,很不错的一道题目。结点属性包括:(1)n1:1的个数;(2)c1:连续1的最大个数;(3)c0:连续0的最大个数;(4)lc1/lc0:从区间左边开始,连续1/0的最大个数;(5)rc1/rc0:从区间右边开始,连续1/0的最大个数;(6)set:置区间为0/1的标记;(7)flip:...
分类:
其他好文 时间:
2015-04-06 18:31:56
阅读次数:
169
题目:leetcode
Longest Consecutive Sequence
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2]...
分类:
其他好文 时间:
2015-04-06 17:22:41
阅读次数:
160
DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18,...
分类:
其他好文 时间:
2015-04-06 16:58:47
阅读次数:
146
题目:Insert a sequence of given numbers into an initially empty min-heap H. Then for any given index i, you are supposed to print the path from H[i] to ...
分类:
其他好文 时间:
2015-04-06 14:10:20
阅读次数:
148
题目链接:点击打开链接
题意:
给出逆序数的值,求原序列(一个1-N的排列)
1, 2, 0, 1, 0 表示1的逆序数是1,2的逆序数是2,3的逆序数是0···
思路:
从最后一个数开始插,每次插到当前序列的第a[i]个数。。
splay模拟
== 这个方法比较直(wu)观(nao),别的方法并没有想出来。。
#include
#includ...
分类:
其他好文 时间:
2015-04-05 23:37:42
阅读次数:
550