二分查找
文章平均质量分 80
哎-哭泣的鱼
这个作者很懒,什么都没留下…
展开
-
【九度】题目1349:数字在排序数组中出现的次数
题目描述:统计一个数字在排序数组中出现的次数。输入:每个测试案例包括两行:第一行有1个整数n,表示数组的大小。1第二行有n个整数,表示数组元素,每个元素均为int。第三行有1个整数m,表示接下来有m次查询。1下面有m行,每行有一个整数k,表示要查询的数。输出:对应每个测试案例,有m行输出,每行1整数,表示数组中该数字出现的次数。样例输原创 2013-12-09 17:56:14 · 1038 阅读 · 0 评论 -
【LeetCode】Search a 2D Matrix && 【九度】题目1384:二维数组中的查找
Search a 2D Matrix Total Accepted: 4984 Total Submissions: 16715 My SubmissionsWrite an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:I原创 2014-01-22 10:12:57 · 1226 阅读 · 0 评论 -
【LeetCode】Merge Intervals && Insert Interval
1、Merge Intervals Total Accepted: 6989 Total Submissions: 34958 My SubmissionsGiven a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],re原创 2014-03-31 19:47:49 · 715 阅读 · 0 评论 -
【LeetCode】Search for a Range
Search for a RangeTotal Accepted: 6500 Total Submissions: 24600 My SubmissionsGiven a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's run原创 2014-02-20 14:35:08 · 781 阅读 · 0 评论 -
【LeetCode】Search in Rotated Sorted Array && Search in Rotated Sorted Array II
1、Search in Rotated Sorted Array Total Accepted: 9880 Total Submissions: 35305 My SubmissionsSuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might原创 2014-03-15 16:52:41 · 715 阅读 · 0 评论 -
【LeetCode】Search Insert Position
Search Insert PositionTotal Accepted: 10088 Total Submissions: 29566 My SubmissionsGiven a sorted array and a target value, return the index if the target is found. If not, return the index where原创 2014-03-12 22:48:03 · 629 阅读 · 0 评论