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 O(log (m+n)).
最后从medianof two sorted arrays中看到...
分类:
其他好文 时间:
2015-01-21 16:31:27
阅读次数:
123
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S="ADOBECODEBA...
分类:
编程语言 时间:
2015-01-21 06:35:47
阅读次数:
255
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
For example,
S = "ADOBECODEBANC"
T = "ABC"
Minimum window is "BAN...
Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.对于这道题,之前并不知道java中有一个封装好的数据结构--优先队列。优先队列其实相当于一个最大或最小堆,能...
分类:
其他好文 时间:
2015-01-18 18:24:56
阅读次数:
210
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...
分类:
其他好文 时间:
2015-01-18 17:04:57
阅读次数:
198
题目:
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 with...
分类:
其他好文 时间:
2015-01-18 13:14:19
阅读次数:
196
The question:Follow upfor "Find Minimum in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?S...
分类:
其他好文 时间:
2015-01-18 07:06:07
阅读次数:
338
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity...
分类:
其他好文 时间:
2015-01-17 17:43:10
阅读次数:
110
Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.最初想法是计算里面能被5整除的数字的个数(因为能被2整除的...
分类:
其他好文 时间:
2015-01-16 16:25:27
阅读次数:
130
Follow up for "Find Minimum in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Suppose a sorted array is rotated at some pivot u...
分类:
其他好文 时间:
2015-01-15 22:14:10
阅读次数:
166