1. Two sum: map解决,扫一遍记录位置为key,值为剩下值。 2. Add Two Numbers: 链表扫一遍, dummy node接算出来的node,跑完一个跑另一个,最后接上多出的node1 136. Single Number: 可以用map也可以用bit manipulati ...
分类:
其他好文 时间:
2016-10-08 18:53:50
阅读次数:
122
1. Two Sum 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 wo ...
分类:
其他好文 时间:
2016-10-07 13:26:05
阅读次数:
249
题目描述: 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 h ...
分类:
其他好文 时间:
2016-10-05 13:11:08
阅读次数:
200
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 ex ...
分类:
其他好文 时间:
2016-10-05 12:40:00
阅读次数:
113
我自己的想法 1. 建一个list。 1)每次add就用Binary search找到插入的位置,插入O(logn) 2) 每次find就two pointer。O(n) 2. 一个arr 1)每次add直接加 O(1) 2)find就先sort,再two pointer. O(nlogn) 3. ...
分类:
其他好文 时间:
2016-09-27 09:08:18
阅读次数:
107
1. Two Sum 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 wo ...
分类:
其他好文 时间:
2016-09-23 12:58:51
阅读次数:
135
题目为leetcode第一道题Two Sum,以下为java写的代码: 当输入数据target=0, nums=[0,4,3,0]时,eclipse上运行的结果与leetcode上运行的不同 1.eclipse下的运行结果: 2.leetcode下的运行结果: 把算法仔细理了一遍觉得并没有错 ,写的 ...
分类:
系统相关 时间:
2016-09-23 11:20:08
阅读次数:
213