题目:
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:
Elements in a triplet (a,b,c) must...
分类:
其他好文 时间:
2016-05-06 16:01:48
阅读次数:
113
题目:
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.翻译:
实现一个方法strStr()。返回字符串needle第一次在字符串haystack出现的下标,如果needle不是haysta...
分类:
其他好文 时间:
2016-04-29 15:39:54
阅读次数:
122
题目:
Given a string containing just the characters , determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but “(]” and “([)]” are not.翻译:...
分类:
其他好文 时间:
2016-03-24 14:49:05
阅读次数:
135
题目:
Given an index k, return the kth row of the Pascal’s triangle.
For example, given k = 3,
Return [1,3,3,1].
Note:
Could you optimize your algorithm to use only O(k) extra space?翻译:
给定一个下标k,返回第...
分类:
其他好文 时间:
2016-03-22 15:06:03
阅读次数:
172
题目:
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca...
分类:
其他好文 时间:
2016-03-22 12:32:36
阅读次数:
194
题目:
Given numRows, generate the first numRows of Pascal’s triangle.
For example, given numRows = 5,
Return[
[1],
[1,1],
[1,2,1],
[1,3,3,1],
[1,4,6,4,1]
]翻译:
给定一个数numRows,产生前numRows行的...
分类:
其他好文 时间:
2016-03-22 12:31:10
阅读次数:
153
题目:
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array.
Example:
For num = 5...
分类:
其他好文 时间:
2016-03-18 21:56:44
阅读次数:
208
题目:
Remove all elements from a linked list of integers that have value val.Example
Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6
Return: 1 –> 2 –> 3 –> 4 –> 5翻译:
从一个整数链表中移除所有value为val的元素。
例如
给定...
分类:
其他好文 时间:
2016-03-18 10:57:09
阅读次数:
167
题目:
Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example:
Given binary tree {3,9,20,#,#,15,7},...
分类:
其他好文 时间:
2016-03-18 00:29:35
阅读次数:
131
题目:
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:
You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold addit...
分类:
其他好文 时间:
2016-03-17 14:46:59
阅读次数:
153