Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. (1) (2) ...
                            
                            
                                分类:
其他好文   时间:
2016-08-23 18:50:47   
                                阅读次数:
139
                             
                         
                    
                        
                            
                            
                                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 functi ...
                            
                            
                                分类:
其他好文   时间:
2016-08-21 13:45:39   
                                阅读次数:
122
                             
                         
                    
                        
                            
                            
                                问题描述:给定字符串S,子串T,求S中包含T的最小窗口 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 ...
                            
                            
                         
                    
                        
                            
                            
                                    Sort a linked list in O(n log n) time using constant space complexity. 归并排序 ...
                            
                            
                                分类:
其他好文   时间:
2016-08-20 21:52:55   
                                阅读次数:
186
                             
                         
                    
                        
                            
                            
                                    Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.这道题如果有第21题 合并两个链表的基础就会比较容易,具体合并链表的时候有两种思路(1)如果k个list... ...
                            
                            
                                分类:
其他好文   时间:
2016-08-14 23:56:46   
                                阅读次数:
201
                             
                         
                    
                        
                            
                            
                                题意: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. (Hard) 分析: 方法1: 利用做过的merge 2 sorted list,将头两个归并 ...
                            
                            
                                分类:
其他好文   时间:
2016-08-13 22:40:14   
                                阅读次数:
253
                             
                         
                    
                        
                            
                            
                                    题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 解析:合并k个已经有序的单链表,使其最终成为一个有序的单链表。原理就是归并排序,递归运算。基本算 ...
                            
                            
                                分类:
编程语言   时间:
2016-08-13 22:33:31   
                                阅读次数:
285
                             
                         
                    
                        
                            
                            
                                    题目:Sort a linked list in O(n log n) time using constant space complexity. 分析:给单链表排序,要求时间复杂度是O(nlogn),空间复杂度是O(1)。时间复杂度为O(nlogn)的排序算法有快速排序和归并排序, 但是,对于单链 ...
                            
                            
                                分类:
编程语言   时间:
2016-08-13 21:01:28   
                                阅读次数:
163
                             
                         
                    
                        
                            
                            
                                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 or ...
                            
                            
                                分类:
其他好文   时间:
2016-08-11 13:02:21   
                                阅读次数:
178
                             
                         
                    
                        
                            
                            
                                    题目 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity ...
                            
                            
                                分类:
其他好文   时间:
2016-08-10 16:13:53   
                                阅读次数:
140