当前位置:网站首页>LeetCode练习2——两数之和
LeetCode练习2——两数之和
2022-07-27 17:30:00 【却道天凉_好个秋】
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;
}边栏推荐
- 如何快速提升抖音小店三分钟回复率?哪些情况会影响抖音小店回复率呢?
- No experts! Growth secrets for junior and intermediate programmers and "quasi programmers" who are still practicing in Universities
- 软件配置 | tigerVNC的下载、安装及配置
- Chapter 2 Introduction
- C# 后台GC 的前因后果
- C170:复试筛选
- 邬贺铨:因地制宜 数字化技术赋能“双碳”实践
- TS2532: Object is possibly ‘undefined‘
- China business CDP white paper | love Analysis Report
- Built in module 10.18
猜你喜欢

Adults have only one main job, but they have to pay a price. I was persuaded to step back by personnel, and I cried all night

Gestureoverlayview (gesture recognition 2)

Global function

VirtualBox: set shared folder

ViewUI 中 DatePicker 日期选择器在 IE11 浏览器中兼容解决方案

System information function of MySQL function summary

Detailed introduction to common coordinate system of cesium

剑指 Offer 25. 合并两个排序的链表

antdv: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key

Cesium常用坐标系详细介绍
随机推荐
pytorch lstm+attention
Basic functions of pytorch tensor
第2章 入门
Version announcement | Apache Doris 1.1 release version officially released!
Qt的QTextToSpeech类实现语音播报功能
C193: scoring system
VALN 11.9
函数总结
PKI/TLS 工具之CFSSL —— 筑梦之路
VALN 11.9
Radiogroup (radio box)
Gestureoverlayview (gesture recognition 2)
LED高精度体重秤方案规格书
信道容量、信道带宽基本概念的理解
【PyTorch系列】PyTorch之torchvision 图像处理库详解
C # find perfect numbers, output daffodils and use of classes
Global function
【C#网络应用编程】实验3:进程管理练习
antdv: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key
NAT 11.16