码迷,mamicode.com
首页 >  
搜索关键字:complexity    ( 1097个结果
Factorial Trailing Zeroes
Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.解析: 只有2和5相乘才会出现0,其中整十也可以看做是2和...
分类:其他好文   时间:2015-03-17 19:47:19    阅读次数:136
[leetcode] Search for a Range
Search for a RangeGiven a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity ...
分类:其他好文   时间:2015-03-17 17:29:47    阅读次数:156
[LeetCode]Sort List
Sort a linked list in O(n log n) time using constant space complexity. 这道题是要求对单链表进行排序,有个O(nlogn)的时间复杂度的要求。我的想法是采取类似头插法的方式,遍历链表结点,设3个指针,min指向当前链表中的最小值,max指向当前链表中的最大值,cur指向前一插入的值。 min , max , cur 初始时都指向第...
分类:其他好文   时间:2015-03-17 15:58:02    阅读次数:181
LeetCode-Single Number
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity...
分类:其他好文   时间:2015-03-17 02:00:44    阅读次数:102
【LeetCode】 sort list 单链表的归并排序
题目:Sort a linked list in O(n log n) time using constant space complexity. 思路:要求时间复杂度O(nlogn) 知识点:归并排序,链表找到中点的方法 存在的缺点:边界条件多考虑!!! /** * LeetCode Sort List Sort a linked list in O(n log n) time us...
分类:编程语言   时间:2015-03-16 23:14:12    阅读次数:260
leetcode题解||Median of Two Sorted Arrays问题
problem: 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)). thinking: (1)求中位数,就是求已...
分类:其他好文   时间:2015-03-16 21:26:18    阅读次数:162
[LeetCode] 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).For example,S="ADOBECODEBA...
分类:Windows程序   时间:2015-03-16 07:36:20    阅读次数:311
Median of Two Sorted Arrays [hard]
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 ...
分类:其他好文   时间:2015-03-15 12:13:53    阅读次数:112
Median of Two Sorted Arrays
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 ...
分类:其他好文   时间:2015-03-14 21:40:42    阅读次数:134
Merge k Sorted Lists
Merge k Sorted Lists问题:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.思路: 归并排序(二分问题)我的代码:public clas....
分类:其他好文   时间:2015-03-13 10:45:10    阅读次数:120
1097条   上一页 1 ... 65 66 67 68 69 ... 110 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!