当前位置:网站首页>Leetcode exercise 2 - sum of two numbers
Leetcode exercise 2 - sum of two numbers
2022-07-27 20:08:00 【But the sky is cold_ Good autumn】
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> vec;
int size = nums.size();
for(int i = 0; i < size; i++)
{
for(int j = i + 1; j < size; j++)
{
if(nums[i] + nums[j] == target)
{
vec.push_back(i);
vec.push_back(j);
break;
}
}
}
return vec;
}边栏推荐
- [C # network application programming] Experiment 3: process management exercise
- 技术分享 | 接口自动化测试中,如何做断言验证?
- [C #] positive sequence, reverse sequence, maximum value, minimum value and average value
- Software configuration | tigervnc download, installation and configuration
- [Redis] Redis穿透、雪崩和击穿
- C background GC cause and effect
- Hacker introductory tutorial (very detailed) from zero basic introduction to proficiency, it is enough to read this one.
- In a real case, college students were cheated when taking orders. I hope you won't be cheated [painful lesson]
- C # find perfect numbers, output daffodils and use of classes
- Rodin 安装 SMT Solvers 插件
猜你喜欢

Rodin installs the SMT solvers plug-in

黑客入门教程(非常详细)从零基础入门到精通,看完这一篇就够了。

如何运行 kevinchappell / formBuilder

UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xff in position 0: invalid start byte

China business CDP white paper | love Analysis Report

mysql数据库中的数据如何加密呢?mysql8.0自带新特性

mysql函数汇总之系统信息函数

连接池-归还连接详解(上)

统一建模语言 (UML) 规范
![[论文阅读] Rich Feature Hierarchies for Accurate Object Detection and Semantic Segmentation](/img/a9/690f52b5c4afba684f0add2434888c.png)
[论文阅读] Rich Feature Hierarchies for Accurate Object Detection and Semantic Segmentation
随机推荐
2022年,软件测试还能学吗?别学了,软件测试岗位饱和了...
Common errors reported by pytorch
Radiogroup (radio box)
Can go to QQ but can't open the web page
C#求完全数,输出水仙花以及类的使用
如何快速提升抖音小店三分钟回复率?哪些情况会影响抖音小店回复率呢?
focal loss
软件配置 | tigerVNC的下载、安装及配置
剑指 Offer 25. 合并两个排序的链表
NAT 11.16
函数优先顺序
11.5.OSPF
PC博物馆(3) MITS Altair 8800
SQLite SQL writing method of creating table joint primary key
黑客入门教程(非常详细)从零基础入门到精通,看完这一篇就够了。
2022爱分析·智慧社区厂商全景报告 厂商征集
十年测试老鸟聊聊移动端兼容性测试
C193: scoring system
C# 后台GC 的前因后果
Built in module 10.18