题目 :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 hav ...
分类:
其他好文 时间:
2016-07-31 20:32:51
阅读次数:
118
一、问题描述 翻译: 给定一个整数数组,找出其中两个数满足相加等于你指定的目标数字。你可以假设每一个输入只有一个结果。举例:输入:nums=[2, 7, 11, 15], target = 9输出:[0,1] 二、解答1.每出现一个值x,直接在数组中寻找是否有等于(target-x)的值 时间复杂度 ...
分类:
编程语言 时间:
2016-04-20 13:39:02
阅读次数:
169
因为leetcode的题号会变动,所以先记录一下每一题对应的内容。 10 Regular Expression Matching 21.6% Hard 9 Palindrome Number 30.9% Easy 8 String to Integer (atoi) 13.3% Easy 7 Rev
分类:
其他好文 时间:
2016-02-25 22:37:35
阅读次数:
386
这是Array里的第一题。题意是找出排序好的数组的数字范围集合。记录的知识点:1, c++中将数字转化为字符串stringstream ss;ss vecStr;string tem;vecStr.push_back(tem);3, 遍历vectorvector::iterator iter;for...
分类:
其他好文 时间:
2015-12-10 21:45:03
阅读次数:
173
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...
分类:
其他好文 时间:
2015-10-13 10:22:26
阅读次数:
156
//定义二维数组int **array = new int*[row_num]; for(int i=0;i> v2(row_num,vector(col_num,0));//删除排好序数组中重复的数据,返回剩余数组的长度//int A[]: input array//len: the arr...
分类:
其他好文 时间:
2015-09-09 22:47:57
阅读次数:
194
题目大概意思就是,我给你传进来一个vector容器和一个target,vector相当于一个数组,现在问target是有数组种哪两个数组成的,返回两个下标,注意函数的返回类型也是vector类型的,所以一定要注意.
题目刚到手的时候,发现这个与各大OJ套路不太一样啊,也就是与ACM不太一样,我还傻傻的调整输出格式什么的,而且这个是完善一个类的成员函数,而不是提交一个可以运行的完整...
分类:
其他好文 时间:
2015-08-30 15:53:07
阅读次数:
170
1 struct ListNode { 2 int val; 3 ListNode *next; 4 ListNode(int x) : val(x), next(NULL) {} 5 }; 6 7 class Solution { 8 public: 9 List...
分类:
其他好文 时间:
2015-08-25 13:44:55
阅读次数:
118
1.题目:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or ...
分类:
其他好文 时间:
2015-07-28 22:39:08
阅读次数:
119
1.题目:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), the plus+or ...
分类:
其他好文 时间:
2015-07-28 00:26:48
阅读次数:
142