Merge two sorted linked lists and return it as
a new list. The new list should be made by splicing together the nodes of the
first two lists./** * Def...
分类:
其他好文 时间:
2014-06-11 22:56:31
阅读次数:
257
1 /* 2 Design and implement a data structure
for Least Recently Used (LRU) cache. It should support the following operations:
get and set. 3 ...
分类:
其他好文 时间:
2014-06-11 13:08:46
阅读次数:
297
/验证规则详细配置 public function rules() { // NOTE: you
should only define rules for those attributes that // will receive user inputs.
...
分类:
其他好文 时间:
2014-06-11 10:05:03
阅读次数:
180
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that i...
分类:
编程语言 时间:
2014-06-08 15:25:00
阅读次数:
282
题目
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should return all 5 unique BST's shown below.
...
分类:
其他好文 时间:
2014-06-08 15:15:26
阅读次数:
223
题目:convert("PAYPALISHIRING", 3) should return "PAHNAPLSIIGYIR".
解题思路:这个是个纯粹找规律的题,其他没啥特殊的。下面的例子nRows=4;
找规律按照数组小标开始,寻找下标出现的规律,
1. 第一行和最后一行相邻元素下标之差为 2*nRows-2;
2. 除过第一行和最后一行,其余行要多一个元素,该元素出现的下标和行号有关,比如5 = 1 + 6 - 2,可以总结出规律为 j + 2*nRows-2 - 2*i;
关于 i 和 j 看以看下面...
分类:
其他好文 时间:
2014-06-08 09:11:57
阅读次数:
230
Single NumberGiven an array of integers, every
element appearstwiceexcept for one. Find that single one.Note:Your algorithm
should have a linear runti...
分类:
其他好文 时间:
2014-06-07 23:44:39
阅读次数:
302
题目:Given a linked list and a valuex, partition it
such that all nodes less thanxcome before nodes greater than or equal tox.You
should preserve the or...
分类:
其他好文 时间:
2014-06-07 20:35:55
阅读次数:
236
A basic requirement is that the function should
provide a uniform distribution of hash values. A non-uniform distribution
increases the number of coll...
分类:
其他好文 时间:
2014-06-07 16:58:29
阅读次数:
240
The expression after ELSE should have the same type as those after THEN: "bigint" is expected but "i...
分类:
其他好文 时间:
2014-06-07 15:41:57
阅读次数:
412