class Solution {
public:
vector<int> twoSum(vector<int>& numbers, int target) {
int n = numbers.size();
vector<int> result;
int i = ;
for (i = ;i<n&&numbers[i]<= target;i++){
for (int j = i+;j<n&&numbers[j]<=target;j++){
if (numbers[i]+numbers[j] == target){
result.push_back(i+);
result.push_back(j+);
return result;
}
}
}
return {};
}
};

leetcode 之 Two Sum II - Input array is sorted c++的更多相关文章

  1. 29. leetcode 167. Two Sum II - Input array is sorted

    167. Two Sum II - Input array is sorted Given an array of integers that is already sorted in ascendi ...

  2. [LeetCode] 167. Two Sum II - Input array is sorted 两数和 II - 输入是有序的数组

    Given an array of integers that is already sorted in ascending order, find two numbers such that the ...

  3. LeetCode 167. Two Sum II - Input array is sorted (两数之和之二 - 输入的是有序数组)

    Given an array of integers that is already sorted in ascending order, find two numbers such that the ...

  4. (双指针 二分) leetcode 167. Two Sum II - Input array is sorted

    Given an array of integers that is already sorted in ascending order, find two numbers such that the ...

  5. 【LeetCode】Two Sum II - Input array is sorted

    [Description] Given an array of integers that is already sorted in ascending order, find two numbers ...

  6. LeetCode 167 Two Sum II - Input array is sorted

    Problem: Given an array of integers that is already sorted in ascending order, find two numbers such ...

  7. ✡ leetcode 167. Two Sum II - Input array is sorted 求两数相加等于一个数的位置 --------- java

    Given an array of integers that is already sorted in ascending order, find two numbers such that the ...

  8. Java [Leetcode 167]Two Sum II - Input array is sorted

    题目描述: Given an array of integers that is already sorted in ascending order, find two numbers such th ...

  9. LeetCode - 167. Two Sum II - Input array is sorted - O(n) - ( C++ ) - 解题报告

    1.题目大意 Given an array of integers that is already sorted in ascending order, find two numbers such t ...

  10. LeetCode 167. Two Sum II – Input array is sorted

    Given an array of integers that is already sorted in ascending order, find two numbers such that the ...

随机推荐

  1. Solidity构造函数和析构函数

    构造函数:当方法名字和合约名字相同的时候,这个就是构造函数,构造函数在合约对象创建之后执行的 contract Person{ function Peron(){//构造函数Person ... } ...

  2. Java的家庭记账本程序(J)

    日期:2019.3.9 博客期:041 星期六 这次就来看看我使用全新的模板写的家庭记账本程序!本次附带配色样式!作为本周的学习进度条吧!明天再研究微信小程序的方法! 这一次的记账本程序加了很多功能! ...

  3. python第六篇文件处理类型

    阅读目录 一 文件操作 二 打开文件的模式 三 操作文件的方法 四 文件内光标移动 五 文件的修改   文件处理                                             ...

  4. Selenium+Python ---- 免登录

    1.免登录在进行测试的过程中难免会遇到登录的情况,给测试工作添加了工作量,本文仅提供一些思路供参考解决方式:手动请求中添加cookies.火狐的profile文件记录信息实现.人工介入.万能验证码.去 ...

  5. 微信支付没有结果通知,notify_url参数的接口没有收到微信支付结果通知

    在微信支付统一下单的时候需要填一个notify_url参数用于处理微信支付结果通知 但是,有时候我们发现我们设置的这个接口收不到微信请求.原因有一下几个,大家一一对照,也欢迎补充. 1. url是否可 ...

  6. 【转载】ImportFbx Errors

    [转自http://blog.csdn.net/chenggong2dm/article/details/39580735] 问题: 在导入动作的时候出现一个错误: ImportFBX Errors: ...

  7. Python2还是Python3

    Python2还是Python3 相信很多新接触Python的人都会纠结这一个问题,学Python2还是Python3? 不像Java一样每个新版本基本都是基本兼容以前的版本的.Python2和Pyt ...

  8. html_基础标签

    块级标签: 默认情况会占位一整行行内(内联)标签:默认只有自己的大小 块级标签如: <div>我是字</div>  <h1>标题1</h1>  < ...

  9. nginx+apache动静分离/负载均衡

    [主从] [Mysql-Master] log-bin=mysql-bin server-id = MariaDB [(none)]> grant replication slave on *. ...

  10. Imcash解读:哪些行业的“饭碗”最容易受区块链的影响?

    或许,你已经听到很多人说,区块链是本世纪一项伟大的革命性技术,在未来“前途无量”. 但是,很少有人能真正接地气地举例说清楚:区块链到底怎么革命,革谁的命,怎么产生价值,将会颠覆哪些行业. 今天,我们就 ...