LeetCode-001 Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2...
分类:
其他好文 时间:
2014-05-15 04:34:50
阅读次数:
293
用暴力水过了两个,正在沾沾自喜,当看到连续加的规模增加到4时,眼泪直接掉下来了,新想这下我这水货原形毕露了,没想到。。
我抱着试试看的心态,又写了一种水水的暴力解,每次固定前面的两个节点,后面的两个按照twosum那套来搞,搞完了移动之前固定的右边的那个点,最后再移动固定的左边的那个点,居然也过了。。
刚想起来其实twosum有一种很优雅的解法,建一个hash表,从头扫描数组,遇到一个数,查找...
分类:
其他好文 时间:
2014-05-15 01:09:26
阅读次数:
235
题目链接附上代码: 1 #include 2 #include 3 #include 4 using
namespace std; 5 6 class Solution { 7 public: 8 vector twoSum(vector
&numbers, int target) ...
分类:
其他好文 时间:
2014-05-08 17:50:11
阅读次数:
253
Given an array of integers, find two numbers
such that they add up to a specific target number.The function twoSum should
return indices of the two nu...
分类:
其他好文 时间:
2014-05-08 06:33:29
阅读次数:
339
[Question]
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to t...
分类:
其他好文 时间:
2014-05-07 05:37:44
阅读次数:
278
Given an array of integers, find two numbers
such that they add up to a specific target number.The function twoSum should
return indices of the two nu...
分类:
其他好文 时间:
2014-05-01 08:35:40
阅读次数:
443
题目: Given an array of integers, find two numbers
such that they add up to a specific target number. The function twoSum should
return indices of the t...
分类:
其他好文 时间:
2014-04-30 03:20:07
阅读次数:
502