Search for a RangeGiven a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity ...
分类:
其他好文 时间:
2014-12-18 00:04:06
阅读次数:
204
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.The first integer of each...
分类:
其他好文 时间:
2014-12-17 21:03:42
阅读次数:
208
标题:Merge Two Sorted Lists通过率:33.1%难度:简单Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the...
分类:
其他好文 时间:
2014-12-17 12:15:01
阅读次数:
196
public TreeNode sortedListToBST(ListNode head) {
if (head == null)
return null;
int len = 0;
ListNode nextNode = head;
while (nextNode != null) {
nextNode = nextNode.next;
len++;
}
return buildTree(head, 0, len - 1);
}
public Tree...
分类:
其他好文 时间:
2014-12-16 21:05:05
阅读次数:
159
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.
Try to solve it in linear time/space.
Return 0 if the array contains less than 2 elements.
Y...
分类:
其他好文 时间:
2014-12-16 19:18:41
阅读次数:
230
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be ...
分类:
其他好文 时间:
2014-12-16 06:30:09
阅读次数:
131
标题:Remove Duplicates from Sorted List通过率:34.5难度:简单Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example...
分类:
其他好文 时间:
2014-12-15 23:23:12
阅读次数:
207
Given a node from a cyclic linked list which has been sorted, write a function to insert a value into the list such that it remains a cyclic sorted li...
分类:
其他好文 时间:
2014-12-15 18:57:44
阅读次数:
158
一、 python提供的对list进行排序的方法 1、方法: ????(1)list的内建函数list.sort进行排序,? ????(2)用序列类型函数sorted(list)进行排序。 2、示例: ? ? >>> a_list = [2,5,4,3,1] ????>...
分类:
编程语言 时间:
2014-12-15 17:29:45
阅读次数:
212
1、题目
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.
Try to solve it in linear time/space.
Return 0 if the array contains less than ...
分类:
编程语言 时间:
2014-12-15 09:00:47
阅读次数:
222