LintCode-剑指Offer-(61)搜索区间
来源:互联网 发布:vue js 编辑:程序博客网 时间:2024/06/06 05:35
class Solution { /** *@param A : an integer sorted array *@param target : an integer to be inserted *return : a list of length 2, [index1, index2] */public: vector<int> searchRange(vector<int> &A,int target) { // write your code here int start = -1; int end = -1; for (int i = 0;i<A.size();i++){ if (A[i]==target&&start==-1) start = i; if (A[i]==target&&start!=-1) end = i; if (A[i]!=target&&start!=-1&&end!=-1)break; } vector<int> r; r.push_back(start); r.push_back(end); return r; }};
0 0
- LintCode-剑指Offer-(61)搜索区间
- lintcode-搜索区间-61
- LintCode 61-搜索区间
- lintcode(61)搜索区间
- LintCode 61 搜索区间
- LintCode-搜索区间
- Lintcode搜索区间
- LintCode : 搜索区间
- LintCode:搜索区间
- LintCode : 搜索区间
- Lintcode 搜索区间
- [LintCode]61.搜索区间
- LintCode 搜索区间
- 搜索区间——LintCode
- LintCode——搜索区间
- LintCode-剑指Offer-(38)搜索二维矩阵Ⅱ
- [Lintcode]Search for a Range搜索区间
- Lintcode 二叉查找树中搜索区间
- 《如何高效学习》心得
- Linux的常用命令1---网络相关(不断添加中)
- http压力测试工具及使用说明
- Windows 下使用Git客户端
- Xcode升到7.1插件失效解决方法
- LintCode-剑指Offer-(61)搜索区间
- Oracle不同版本中序列的注意点
- OpenJudge_P8785 装箱问题(DP+01背包)
- Maven骨架的使用
- lcd probe函数 赏析
- iOS笔记--oc语法8 (@synthesize和@dynamic的区别)
- POJ3083 Children of the Candy Corn 解题思路
- JS中的两个规范 CMD和AMD
- poj3070 Fibonacci(矩阵快速幂)