###### Easy-题目68：1. Two Sum（增补1）

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].

public class Solution {
public int[] twoSum(int[] nums, int target) {
for(int i = 0;i<nums.length;i++) {
for(int j=i+1;j<nums.length;j++) {
if(nums[i]+nums[j]==target)
return new int[]{i,j};
}
}
return new int[]{-1,-1};
}
}

42ms,beats 19.97%,众数6ms,35.54%
Cmershen的碎碎念：

#### 【LeetCode】LeetCode——第1题：Two Sum

2016-01-04 17:01:58

#### 1. Two Sum [easy] (Python)

2016-07-26 20:19:37

#### Leet Code OJ 1. Two Sum [Difficulty: Easy]

2016-03-14 20:33:57

#### [LeetCode]1 Two Sum(C++,Python实现)

2014-05-16 21:17:33

#### leetcode【1+167 Two Sum 系列】【python】

2016-09-01 19:31:36

#### 1. Two Sum（重要！）

2016-07-09 16:21:27

#### leetcode 1:TwoSum (C#语言版)

2016-04-04 16:27:12

#### LeetCode题解--1. Two Sum(和为S的两个数字)

2016-01-27 22:32:25

#### [leetcode]1. Two Sum -- JavaScript 代码

2016-09-04 15:23:20

#### leetCode 1. Two Sum 解题思路和方法

2015-06-30 16:20:35

## 不良信息举报

Easy-题目68：1. Two Sum（增补1）