leetcode 167 Two Sum II - Input array is sorted C++
来源:互联网 发布:淘宝医药商城 编辑:程序博客网 时间:2024/05/17 07:00
这个太简单了,不说了。
vector<int> twoSum(vector<int>& numbers, int target) { int tail = numbers.size() - 1; int head = 0; vector<int> vec; while(head<tail){ if(numbers[tail]+numbers[head]>target){ tail--; }else if(numbers[tail]+numbers[head]<target){ head++; }else{ vec.push_back(head+1); vec.push_back(tail+1); return vec; } } return vec; }
0 0
- leetcode 167: Two Sum II - Input array is sorted
- Leetcode NO.167 Two Sum II - Input array is sorted
- [leetcode 167] Two Sum II - Input array is sorted
- LeetCode 167: Two Sum II - Input array is sorted
- leetcode 167 Two Sum II - Input array is sorted C++
- LeetCode 167 Two Sum II - Input array is sorted
- LeetCode #167: Two Sum II - Input array is sorted
- LeetCode 167:Two Sum II - Input array is sorted
- LeetCode[167] Two Sum II - Input array is sorted
- Leetcode #167 Two Sum II - Input array is sorted
- Leetcode 167 Two Sum II - Input array is sorted
- leetcode 167 Two Sum II - Input array is sorted
- [LeetCode]167 Two Sum II - Input array is sorted
- [C语言][LeetCode][167]Two Sum II - Input array is sorted
- LeetCode-Two Sum II - Input array is sorted
- [Leetcode]Two Sum II - Input array is sorted
- leetcode--Two Sum II - Input array is sorted
- LeetCode 题解(274) : Two Sum II - Input array is sorted
- 矩阵快速幂
- Android Bluetooth(蓝牙)实例
- leetcode 24. Swap Nodes in Pairs
- 两个链表的第一个公共节点
- SGU 223 little kings BSOJ2772 状压DP
- leetcode 167 Two Sum II - Input array is sorted C++
- struts令牌机制
- Java中反射知识的理解介绍
- Scala10
- poj 3348 Cows
- Hive安装
- transaction简介
- 2016年之年中总结
- Best Time to Buy and Sell Stock II