题目链接:https://leetcode.com/problems/palindrome-pairs/
题目:
Given a list of unique words. Find all pairs of distinct indices (i,
j) in the given list, so that the concatenation of the two words, ...
分类:
其他好文 时间:
2016-07-10 18:48:22
阅读次数:
186
grep 'str'用来选取含有str的行 参数: -v 反向选取 -n 显示行号 -c 计算查找到字符串的次数 -i 选取时不区分大小写 基础正则表达式符: [list] 从字符集合里选出任意一个字符 [^lis] 不选字符集中的任意一个字符 [n-m] 字符范围,如[0-9]或[a-z] ‘^s ...
分类:
其他好文 时间:
2016-07-10 15:27:06
阅读次数:
146
生成列表 要生成list [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],我们可以用range(1, 11): >>> range(1, 11) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 但如果要生成[1x1, 2x2, 3x3, ..., 10x10]怎么做? ...
分类:
编程语言 时间:
2016-07-10 15:24:02
阅读次数:
603
redis的list类型其实就是一个每个子元素都是string类型的双向链表。所以[lr]push和[lr]pop命令的算法时间复杂度都是O(1)。另外list会记录链表的长度。所以llen操作也是O(1).链表的最大长度是(2的32次方-1)。我们可以通过push,pop操作从链表的头部或者尾部添 ...
分类:
其他好文 时间:
2016-07-10 14:04:47
阅读次数:
156
什么是迭代 在Python中,如果给定一个list或tuple,我们可以通过for循环来遍历这个list或tuple,这种遍历我们成为迭代(Iteration)。 在Python中,迭代是通过 for ... in 来完成的,而很多语言比如C或者Java,迭代list是通过下标完成的,比如Java代 ...
分类:
编程语言 时间:
2016-07-10 13:59:49
阅读次数:
314
源码: <input type="checkbox" id="cleckAll" />全选 <div class="list"> <input type="checkbox" />复选一 <input type="checkbox" />复选二 <input type="checkbox" />复选 ...
分类:
其他好文 时间:
2016-07-10 12:30:43
阅读次数:
98
对list进行切片 取一个list的部分元素是非常常见的操作。比如,一个list如下: >>> L = ['Adam', 'Lisa', 'Bart', 'Paul'] 取前3个元素,应该怎么做? 笨办法: >>> [L[0], L[1], L[2]] ['Adam', 'Lisa', 'Bart' ...
分类:
编程语言 时间:
2016-07-10 12:24:38
阅读次数:
170
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then l ...
分类:
其他好文 时间:
2016-07-10 11:05:03
阅读次数:
133