摘要:
Implementint sqrt(int x).Compute and return the square root ofx.思路:binary search ,柯西不等式√abx/mid) b=mid-1; else a=mid+1; } ... 阅读全文
posted @ 2015-03-12 22:06
jasmine_turnsoul
阅读(167)
评论(0)
推荐(0)
摘要:
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... 阅读全文
posted @ 2015-03-12 20:02
jasmine_turnsoul
阅读(113)
评论(0)
推荐(0)
摘要:
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文
posted @ 2015-03-12 19:39
jasmine_turnsoul
阅读(157)
评论(0)
推荐(0)
摘要:
it's suprised me!but it is a real problem in practice.remember it , change your solid style. 阅读全文
posted @ 2015-03-12 14:56
jasmine_turnsoul
阅读(124)
评论(0)
推荐(0)
摘要:
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... 阅读全文
posted @ 2015-03-12 14:52
jasmine_turnsoul
阅读(110)
评论(0)
推荐(0)
摘要:
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value t... 阅读全文
posted @ 2015-03-12 13:16
jasmine_turnsoul
阅读(128)
评论(0)
推荐(0)
摘要:
A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index.... 阅读全文
posted @ 2015-03-12 10:16
jasmine_turnsoul
阅读(132)
评论(0)
推荐(0)
摘要:
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.You m... 阅读全文
posted @ 2015-03-12 10:06
jasmine_turnsoul
阅读(107)
评论(0)
推荐(0)

浙公网安备 33010602011771号