题目Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.代码 public static ListNode deleteD...
分类:
其他好文 时间:
2015-03-02 13:17:21
阅读次数:
133
题目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 from B. T...
分类:
其他好文 时间:
2015-03-02 11:19:23
阅读次数:
148
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).
You are given a target value to search. If found in the array retur...
分类:
其他好文 时间:
2015-02-28 23:05:35
阅读次数:
177
题目:
1、Sort a linked list using insertion sort
2、Merge
two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
3、Sor...
分类:
编程语言 时间:
2015-02-28 21:46:36
阅读次数:
288
[LeetCode] 004. Median of Two Sorted Arrays (Hard) (C++/Java/Python)...
分类:
编程语言 时间:
2015-02-28 00:18:25
阅读次数:
167
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array....
分类:
其他好文 时间:
2015-02-26 20:22:53
阅读次数:
118
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.解法:自底向上 时间复杂度O(n), 空间复杂度O(logN) 1 clas...
分类:
其他好文 时间:
2015-02-26 19:58:04
阅读次数:
166
Redis是最快的key-value分布式缓存之一缺点: 没有本地数据缓冲, 目前还没有完整的数据聚集化支持优点: 配置简单, 使用方便, 高性能,支持不同的数据类型(hashes, lists, sets, sorted sets)地址:http://www.cnblogs.com/davidgu...
题目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 题意: 将k个已排好序的链表合并为一个非下降排序的链表。 思路: 将每个链表的表头元素取出来,...
分类:
其他好文 时间:
2015-02-26 11:24:57
阅读次数:
145
We essentailly do an in-order traversal (中序遍历) of the tree since the in-order traversal results in a sorted list of node items.1 def traverse_binary_t...
分类:
其他好文 时间:
2015-02-26 06:28:30
阅读次数:
155