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-19 18:56:06
阅读次数:
91
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 ...
分类:
编程语言 时间:
2015-05-19 12:24:16
阅读次数:
112
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 should be O(log (m+n)).问题分析首先...
分类:
其他好文 时间:
2015-05-18 23:04:00
阅读次数:
156
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 = "ADOBECOD...
分类:
编程语言 时间:
2015-05-18 22:48:32
阅读次数:
272
题目:Sort a linked list inO(nlogn) time using constant space complexity.代码:/** * Definition for singly-linked list. * struct ListNode { * int val; *...
分类:
其他好文 时间:
2015-05-18 22:34:18
阅读次数:
119
题目:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.代码:/** * Definition for singly-linked list. * struc...
分类:
其他好文 时间:
2015-05-18 20:46:25
阅读次数:
105
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-05-17 20:11:30
阅读次数:
126
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity...
分类:
其他好文 时间:
2015-05-16 23:06:06
阅读次数:
148
SearchinRotatedSortedArrayIITotalAccepted:35100TotalSubmissions:111308MySubmissionsQuestionSolutionFollowupfor"SearchinRotatedSortedArray":Whatifduplicatesareallowed?Wouldthisaffecttherun-timecomplexity?Howandwhy?Writeafunctiontodetermineifagiventargetisint..
分类:
其他好文 时间:
2015-05-16 18:37:20
阅读次数:
158
Problem:
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 order of O(log n).
If the target...
分类:
编程语言 时间:
2015-05-14 22:03:52
阅读次数:
133