【题目】
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 "BANC".
Note:
If there is no such window in S that covers ...
分类:
其他好文 时间:
2014-06-05 11:14:26
阅读次数:
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 "BANC".
Note:
If there is no such window in S that covers ...
Mergeksorted linked lists and return it as one
sorted list. Analyze and describe its
complexity./***Definitionforsingly-linkedlist.*structListNode{*in...
分类:
其他好文 时间:
2014-06-04 21:08:57
阅读次数:
381
Follow up for "Search in Rotated Sorted
Array":What ifduplicatesare allowed?Would this affect the run-time complexity?
How and why?Write a function to...
分类:
其他好文 时间:
2014-06-04 20:17:05
阅读次数:
249
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...
When I finished reading this problem,I thought
I could solve it by scan every single subarray in the array,and the time
complexity is cubic.Every su.....
分类:
其他好文 时间:
2014-06-04 15:30:52
阅读次数:
255
【题目】
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 array.
【题意】
在“Search in Rotated Sorted Array”的基...
分类:
其他好文 时间:
2014-06-03 01:55:38
阅读次数:
173
Sort ListSort a linked list inO(nlogn) time
using constant space
complexity.要求时间复杂度为O(nlogn),那么不能用quickSort了(最坏O(n^2)),所以使用mergeSort.通常写排序算法都是基于数组的,这题...
分类:
其他好文 时间:
2014-06-02 06:29:51
阅读次数:
192
Given an array of integers, every element
appearstwiceexcept for one. Find that single one.Note:Your algorithm should have
a linear runtime complexity...
分类:
其他好文 时间:
2014-05-30 16:16:29
阅读次数:
190
Sort a linked list inO(nlogn) time using
constant space complexity./** * Definition for singly-linked list. * struct
ListNode { * int val; * L...
分类:
其他好文 时间:
2014-05-30 15:17:18
阅读次数:
312