Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord...
分类:
其他好文 时间:
2014-06-27 22:25:10
阅读次数:
443
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-06-27 13:03:49
阅读次数:
136
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
分类:
其他好文 时间:
2014-06-27 12:29:18
阅读次数:
294
题目: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 ...
分类:
其他好文 时间:
2014-06-27 11:55:43
阅读次数:
187
Sort a linked list in O(n log n) time using constant space complexity.思路:使用O(nlogn)时间复杂度和常数空间复杂度,我们想到可以用归并排序。1)找到链表中间位置2)将两个链表按序合并链表3)对所给链表进行整体的归并排序/*...
分类:
其他好文 时间:
2014-06-27 00:22:37
阅读次数:
303
【题目】
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
【题意】
给定一个整数数组,其中除了一个数以外,其他数都是成对出现的,...
分类:
其他好文 时间:
2014-06-26 10:13:27
阅读次数:
254
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Write a function to determine if a given target is in the...
分类:
其他好文 时间:
2014-06-26 07:09:01
阅读次数:
213
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-06-25 14:58:16
阅读次数:
210
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using e...
分类:
其他好文 时间:
2014-06-24 23:30:08
阅读次数:
278
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without u...
分类:
其他好文 时间:
2014-06-24 15:52:58
阅读次数:
222