题目:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not poss...
分类:
其他好文 时间:
2014-07-07 10:57:23
阅读次数:
175
iOS开发网络篇—文件下载(四·暂停和恢复)一、Range简单说明通过设置请求头Range可以指定每次从网路下载数据包的大小Range示例bytes=0-499 从0到499的头500个字节bytes=500-999 从500到999的第二个500字节bytes=500- 从500字节以后的所有字节...
分类:
移动开发 时间:
2014-07-02 20:56:14
阅读次数:
244
#!/usr/bin/python# Filename: for.pyfor i in range(1, 5): print ielse: print 'The for loop is over'for循环在这个范围内递归——for i in range(1,5)等价于for i in ...
分类:
编程语言 时间:
2014-07-02 19:12:24
阅读次数:
288
标准库:一些最爱
集合、堆和双端队列
集合
集合Set类位于sets模块中。
>>> range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> set(range(10))
set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
集合是由序列(或其他可迭代的对象)构建的。主要用于检查成员资格,因此,副本是被忽略的:
>>> r...
分类:
编程语言 时间:
2014-07-02 08:44:12
阅读次数:
206
importrandom
#引入随机函数
ab=range(1,100)
#随机数取值范围
an=random.smaple(ab,4)
#在100以内的数获取4个随机数。
print(an)
#打印这4个随机数
分类:
编程语言 时间:
2014-07-02 06:29:10
阅读次数:
209
vim中将tab自动转换成空格在vim中,有时需要将tab转换成space。使用ret命令(replace tab)。[range]ret[ab]! [new-tabstop]举例:将第一行到文件尾的tab转换成space,每个tab用4个space替代。:set expandtab:%ret! 4...
分类:
其他好文 时间:
2014-07-01 20:23:15
阅读次数:
458
PalindromesA regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string"ABCDEDCBA"is a palindr...
分类:
其他好文 时间:
2014-07-01 18:52:11
阅读次数:
460
Commercial vacuum cleaners range in cost from 200 to 2000 dollars . When you purchase a commercial vacuum cleaner you should look at the purchase as a...
分类:
其他好文 时间:
2014-07-01 18:40:25
阅读次数:
178
Combinations:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ ...
分类:
其他好文 时间:
2014-07-01 12:58:20
阅读次数:
212
题目
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 it a...
分类:
其他好文 时间:
2014-07-01 09:11:07
阅读次数:
206