遇到的问题:input{1,1,1}, output{1,1}, expected{1},
原因在于若temp.val==temp.next.val, 则需要temp.next=temp.next.next,
这时候就不要temp=temp.next了注意停止条件不光是temp!=null,还应该有...
分类:
其他好文 时间:
2014-05-05 22:47:08
阅读次数:
454
Link:http://oj.leetcode.com/problems/reverse-nodes-in-k-group/Given a linked
list, reverse the nodes of a linked listkat a time and return its modifie...
分类:
其他好文 时间:
2014-05-05 22:46:42
阅读次数:
456
Link:http://oj.leetcode.com/problems/reverse-linked-list-ii/Reverse a linked
list from positionmton. Do it in-place and in one-pass.For example:Given1...
分类:
其他好文 时间:
2014-05-05 22:46:11
阅读次数:
411
Link:http://oj.leetcode.com/problems/swap-nodes-in-pairs/Given a linked list,
swap every two adjacent nodes and return its head.For example,Given1->2-...
分类:
其他好文 时间:
2014-05-05 22:45:37
阅读次数:
331
1. introductionfrom numpy import
*random.rand(4,4)#array to matrixrandMat=mat(randon.rand(4,4))#matrix
inverseIvrandMat=randMat.I#indentity matrixeye(...
分类:
编程语言 时间:
2014-05-05 22:24:10
阅读次数:
336
列表推导式(list
comprehension)是利用其他列表创建新列表(类似于数学术语中的集合推导式)的一种方法。它的工作方式类似于for循环,也很简单:In [39]:
[x*x for x in range(10)]Out[39]: [0, 1, 4, 9, 16, 25, 36, 49, ...
分类:
编程语言 时间:
2014-05-05 22:21:48
阅读次数:
422
先从中国天气网得到数据('http://www.weather.com.cn/data/cityinfo/'+城市编码),每个城市都有各自的编码,如何得到用户所在地的城市编码呢?用一个网页就是专门干这个的!http://61.4.185.48:81/g/...
分类:
编程语言 时间:
2014-05-04 00:27:18
阅读次数:
494
Input
t – the number of numbers in list, then t lines follow [t
Each line contains one integer: N [0 N
Output
Output given numbers in non decreasing order.
Example
Input:
5
5
3
...
分类:
其他好文 时间:
2014-05-04 00:04:09
阅读次数:
376
就是找到硬盘中所有的MP3文件和wma文件,再随机打开其中的一个。...
分类:
编程语言 时间:
2014-05-03 17:10:52
阅读次数:
286
这里以在windows下搜索并启动QQ为例,我先把开始菜单、桌面和快速启动栏找了一遍,这样能缩短查找时间。如果找不到再到每个分区中查找。...
分类:
编程语言 时间:
2014-05-03 16:34:02
阅读次数:
275