码迷,mamicode.com
首页 >  
搜索关键字:merge k sorted lists    ( 11722个结果
Leetcode:convert_sorted_array_to_binary_search_tree
BST的中序遍历是一个sorted-array,再构造回去成一个BST,先将中间的元素作为根节点,这个节点的左右分别是左子树和右子树。如此递归地进行即可。...
分类:其他好文   时间:2014-10-10 02:19:43    阅读次数:173
leetcode--Add Two Numbers
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
Erlang生成式实现的列表去重、求交集及并集
%集合去重,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
leetcode 2.Median of Two Sorted Arrays
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
ubuntu apt-get update 失败 解决方案
找了好多资料,最终都没有搞定,自己研究吧(当然也要查资料) 失败的主要原因是不能访问到repository,至于为什么访问不到,可能是被强了,也可能是真的老了 1,关闭所以源 (怎么着software sources 自己搜索吧) 2,删除/var/lib/apt/lists 所有文件 3,添加阿里云镜像https://launchpad.net/ubunt...
分类:其他好文   时间:2014-10-09 21:09:17    阅读次数:180
第13题 Add Two Numbers
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
LeetCode Search in Rotated Sorted Array
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
第十二题 Merge Sorted Array
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
Searching an Element in a Rotated Sorted Array
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
Finding intersection of two sorted arrays
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!