BST的中序遍历是一个sorted-array,再构造回去成一个BST,先将中间的元素作为根节点,这个节点的左右分别是左子树和右子树。如此递归地进行即可。...
分类:
其他好文 时间:
2014-10-10 02:19:43
阅读次数:
173
Problem: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...
分类:
其他好文 时间:
2014-10-10 01:32:53
阅读次数:
213
%集合去重,Acc初始传入为[],存放的是最终的结果
delSame([],Acc) -> Acc;
delSame([Pre|T],Acc) ->checkSame([X||X
%求交集
crossList(L1,L2) ->
[X||X
%求并集
mergeList(L1,L2)->
delSame(lists:merge(L1,L2),[]).
...
分类:
其他好文 时间:
2014-10-10 00:44:13
阅读次数:
379
Median of Two Sorted Arrays Problem:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The ov...
分类:
其他好文 时间:
2014-10-10 00:04:57
阅读次数:
296
找了好多资料,最终都没有搞定,自己研究吧(当然也要查资料)
失败的主要原因是不能访问到repository,至于为什么访问不到,可能是被强了,也可能是真的老了
1,关闭所以源 (怎么着software sources 自己搜索吧)
2,删除/var/lib/apt/lists 所有文件
3,添加阿里云镜像https://launchpad.net/ubunt...
分类:
其他好文 时间:
2014-10-09 21:09:17
阅读次数:
180
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 as a link...
分类:
其他好文 时间:
2014-10-09 17:15:15
阅读次数:
218
Search in Rotated Sorted Array
Total Accepted: 27955 Total
Submissions: 97929My Submissions
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 ...
分类:
其他好文 时间:
2014-10-09 16:29:38
阅读次数:
177
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements fro...
分类:
其他好文 时间:
2014-10-09 15:58:28
阅读次数:
232
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). How do you find an elemen...
分类:
其他好文 时间:
2014-10-09 14:22:13
阅读次数:
332
Find the intersection of two sorted arrays.Let’s called array1 as A and array2 as B, each with size m and n.The obvious brute-force solution is to sca...
分类:
其他好文 时间:
2014-10-09 14:20:13
阅读次数:
161