当前位置:网站首页>1. 两数之和
1. 两数之和
2022-07-28 09:53:00 【vv1025】
1. 两数之和
难度简单12362收藏分享切换为英文接收动态反馈
给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。
你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。
你可以按任意顺序返回答案。
示例 1:
输入:nums = [2,7,11,15], target = 9
输出:[0,1]
解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。示例 2:
输入:nums = [3,2,4], target = 6
输出:[1,2]示例 3:
输入:nums = [3,3], target = 6
输出:[0,1]提示:
2 <= nums.length <= 104-109 <= nums[i] <= 109-109 <= target <= 109- 只会存在一个有效答案
进阶:你可以想出一个时间复杂度小于 O(n2) 的算法吗?
评论
有人相爱,有人夜里开车看海,有人leetcode第一题都做不出来。
运行一夜了是不是超时了?
第一题就给我干废了?我这是上了个假大学?马上大三的人了,我天啊
梦还没开始就破碎了
梦刚开始就要结束了。。。
边栏推荐
- Flink - checkpoint Failure reason: Not all required tasks are currently running
- Flink - checkpoint Failure reason: Not all required tasks are currently running
- JS promotion: the underlying principle of flat tiling
- ASP. Net core 6 framework unveiling example demonstration [29]: building a file server
- Plato farm - a farm meta universe game with Plato as the goal
- Deepin 下安装 LAMP
- 为报复公司解雇,我更改了项目的所有代码注释!
- SQL Server、MySQL主从搭建,EF Core读写分离代码实现
- SQL server, MySQL master-slave construction, EF core read-write separation code implementation
- 今天和大家聊一聊mysql数据库的数据类型
猜你喜欢

OSPF的LSA及优化

高温天气筑牢安全生产防线,广州海珠区开展加油站应急演练

Time series analysis 41 - time series prediction tbats model

How to get more marks in the game under the new economic model of Plato farm

In retaliation for the dismissal of the company, I changed all code comments of the project!

二分、三分、01分数规划 【第I弹】

13 probability distributions that must be understood in deep learning

房地产数字化转型方案:全方位数智化系统运营,助力房企管控实效提升

高温持续,公交企业开展安全专项培训

Joint search set
随机推荐
Plato Farm-以柏拉图为目标的农场元宇宙游戏
Description of landingsite electronic label quppa firmware entering DFU status
Take you to wechat applet development in 3 minutes
PHP7 中 ?? 与? :的区别
[learning notes] border and period
Espresso systems, which has just obtained financing, has both intellectual property rights and team ethics in trouble
JWT login authentication + token automatic renewal scheme, well written!
Irregular area of OSPF, LSA and serial number
matlab特征点提取--记录自用
(10) Defer keyword
Arthas tutorial
LinkedList源码按摩,啊舒服
LIBCMTD.lib
Holy Grail of web and double wing layout, float, clear, both
2021.07.13 我们是这样崩的
高温天气筑牢安全生产防线,广州海珠区开展加油站应急演练
Plato farm - a farm meta universe game with Plato as the goal
[esp32][esp idf] esp32s3 quickly build lvglv7.9
SkiaSharp 之 WPF 自绘 拖曳小球(案例版)
Thinking and summary of technical personnel | R & D Efficiency