0x00 问题描述

Given an array of integers, return indices of the two numbers such that they add up to a specific target.
已知一组整数,返回两个整数的索引值,两个整数相加必须等于给定目标整数

You may assume that each input would have exactly one solution, and you may not use the same element twice.
假设只有一种答案的可能且每个数字只能使用一次,既不能重复相加。

Example:

Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].


- 阅读剩余部分 -