二分查找
文章平均质量分 56
back-to-back
忙忙碌碌终日,终于一事无成。
展开
-
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原创 2016-04-11 13:01:25 · 235 阅读 · 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?Suppose a sorted array is rotated at some pivot unk原创 2016-05-06 14:49:11 · 311 阅读 · 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原创 2016-03-18 22:59:01 · 339 阅读 · 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原创 2016-05-06 15:59:03 · 296 阅读 · 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原创 2016-05-09 13:22:58 · 279 阅读 · 0 评论 -
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原创 2016-05-09 22:40:40 · 333 阅读 · 0 评论