Tiny656

我不会轻易流泪,直到我的梦想成为现实,我再将所有的辛苦和泪水抛洒。

随笔分类 -  LeetCode

[LeetCode] Two Sum
摘要:问题:找出数组中两个数之和等于一个给定目标数。并输出这两个数在数组中的下标。1.暴力O(n^2),两个for循环查找,TLE。 1 class Solution { 2 public: 3 vector twoSum(vector &numbers, int target) { 4 5 vector ans; 6 for (int i = 0; i &a, const pair &b) { 2 if (a.first == b.first) return a.second twoSum(vector &numbers, int... 阅读全文

posted @ 2014-02-01 21:33 Tiny656 阅读(275) 评论(0) 推荐(0) 编辑

导航

统计信息

点击右上角即可分享
微信分享提示