Binary Search
文章平均质量分 68
NoooName
这个作者很懒,什么都没留下…
展开
-
[Leetcode]Search in Rotated Sorted Array II
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 to determine if a given target is in the原创 2015-01-07 14:45:21 · 304 阅读 · 0 评论 -
[Leetcode]Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a target value to search. If found in the array retur原创 2015-01-07 12:20:02 · 275 阅读 · 0 评论 -
[Leetcode]Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right.The first integer of each原创 2015-01-07 23:14:00 · 338 阅读 · 0 评论 -
[Leetcode]Find Minimum in Rotated Sorted Array II
Follow up for "Find Minimum in Rotated Sorted Array": What if duplicates are allowed? Would this affect the run-time complexity? How and why? Find Minimum in Rotated Sorted Array的扩展题,这题中有重复元素的出原创 2015-01-07 22:31:15 · 382 阅读 · 0 评论 -
[Leetcode]Find Minimum in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. You may assume no duplicate exists in原创 2015-01-07 15:38:28 · 301 阅读 · 0 评论 -
[Leetcode]Search for a Range
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 is not found原创 2015-01-08 22:11:19 · 255 阅读 · 0 评论 -
[Leetcode]Find Peak Element
A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its index. The array may contain multiple peaks, in原创 2015-01-08 14:58:25 · 295 阅读 · 0 评论