一、原题
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.
Example:
Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1].
二、思路
给出一个整数数组,并给出一个目标值;找出两个元素,使得元素相加刚好是目标值(假设一定存在这样的两个数),返回这两个元素的下标
该题的时间复杂度接近n方,使用了两层循环来完成该题。
三、代码