leetcode 34[medium]---Search for a Range
2017-12-18 23:37
429 查看
难度:mediumGiven an array of integers sorted in ascending order, 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 in the array, return
Given
return
[-1, -1].For example,
Given
[5, 7, 7, 8, 8, 10]and target value 8,
return
[3, 4].思路:有点搞不懂leetcode的难度分类,明明有些easy级别的题都要难出此题很多。当然也许是自己的python知识结构还太不完善的原因。 给定一个已经sort过的array,找出给定target所在的范围,如果array中没有与target值相同的element则return[-1,-1]. 如果array中只有一个target的element,return[i,i].
相关文章推荐
- Leetcode 34. Search for a Range (Medium) (java)
- [array] leetcode - 34. Search for a Range - Medium
- Leetcode: 34. Search for range(Week9, Medium)
- Leetcode 34. Search for a Range (Medium) (cpp)
- LeetCode-34-Search for a Range(二分法)-Medium
- [Leetcode 34, Medium] Search for a Range
- Leetcode-34-Search for a Range-(Medium)
- LeetCode 34. Search for a Range(搜索范围)
- 【C++】【LeetCode】34. Search for a Range
- [leetcode 34] Search for a Range
- [LeetCode]34. Search for a Range
- Leetcode——34. Search for a Range
- leetcode 34. Search for a Range
- leetcode——34search-for-a-range
- [Leetcode] 34. Search for a Range 解题报告
- 【LeetCode题意分析&解答】34. Search for a Range
- Medium 34题 Search for a Range
- [Leetcode] 34. Search for a Range
- Leetcode-34. Search for a Range
- [Leetcode]_34 Search for a Range