题目描述:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.解题思路:分而自治方法。将K个List不断地分解为前半部分和后半部分。分别进行两个List的合...
分类:
编程语言 时间:
2015-05-14 20:09:23
阅读次数:
127
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...
分类:
其他好文 时间:
2015-05-13 22:01:30
阅读次数:
138
Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity. 1 class Solution { 2 publ...
分类:
其他好文 时间:
2015-05-13 08:45:27
阅读次数:
134
Single Number
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 imple...
分类:
其他好文 时间:
2015-05-12 23:10:19
阅读次数:
160
题目描述
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 w...
分类:
其他好文 时间:
2015-05-11 22:12:08
阅读次数:
145
Problem:
Merge k sorted
linked lists and return it as one sorted list. Analyze and describe its complexity.
Solution:
采用胜者树的方法,胜者树介绍:胜者树,假如链表数组长度为n,链表元素总个数为k,那么时间复杂度为O(k*log(n))
题目大意:
...
分类:
编程语言 时间:
2015-05-11 16:07:50
阅读次数:
128
题目Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.分析Note中提示让用对数的时间复杂度求解,那么如果粗...
分类:
编程语言 时间:
2015-05-11 12:48:10
阅读次数:
205
Minimum Window Substring问题: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)...
There are two sorted arraysnums1andnums2of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should...
分类:
其他好文 时间:
2015-05-10 20:08:21
阅读次数:
125
问题 Median of Two Sorted ArraysThere 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)).
分析本题更经...
分类:
编程语言 时间:
2015-05-10 19:03:48
阅读次数:
119