题目
Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m = 2 and n =
4,
return 1->4->3->2->5->NULL.
Note:
Given m,...
分类:
其他好文 时间:
2014-06-11 06:07:11
阅读次数:
392
题目:
Given two sorted integer arrays A and B, merge B into A as one sorted array.
原题链接(点我)
解题思路:
合并两个数组为一个有序数组,这题也很简单,唯一考查的地方就是怎么处理数组,是从前往后还是从后往前。一般情况,从后往前的效率比从前往后高,也要省不少事。代码如下,从后开始合并。
代码实现:...
分类:
其他好文 时间:
2014-06-11 00:37:42
阅读次数:
314
题目描述Dominos are lots of fun. Children like to stand
the tiles on their side in long lines. When one domino falls, it knocks down the
next one, which k...
分类:
其他好文 时间:
2014-06-10 12:08:55
阅读次数:
232
1 class Solution { 2 public: 3 int
singleNumber(int A[], int n) { 4 int i,j; 5 for(i=0; i<n; i++) 6 { 7 for(j...
分类:
移动开发 时间:
2014-06-10 11:41:55
阅读次数:
259
The count-and-say sequence is the sequence of
integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one
1"or11.11is read off as"tw...
分类:
其他好文 时间:
2014-06-10 10:41:04
阅读次数:
147
Find the contiguous subarray within an array
(containing at least one number) which has the largest sum.For example, given
the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2014-06-10 09:14:50
阅读次数:
211
The oldest solution that people still use for
this problem is select(). The select() call takes three sets of fds (implemented
as bit arrays): one for...
分类:
编程语言 时间:
2014-06-10 08:26:42
阅读次数:
325
Two players, S and T, are playing a game where they make alternate moves. S plays
first.
In this game, they start with an integer N. In each move, a player removes one digit from the integer and p...
分类:
其他好文 时间:
2014-06-10 06:31:29
阅读次数:
302
问题描述:
A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabeti...
分类:
其他好文 时间:
2014-06-10 06:13:21
阅读次数:
299
题目
Given a non-negative number represented as an array of digits, plus one to the number.
The digits are stored such that the most significant digit is at the head of the list.
方法
...
分类:
其他好文 时间:
2014-06-10 06:12:06
阅读次数:
285