题目:Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or eq...
分类:
其他好文 时间:
2014-07-10 14:41:23
阅读次数:
177
3882 - And Then There Was One
Time limit: 3.000 seconds
Let's play a stone removing game.
Initially, n stones are arranged on a circle and numbered
1,..., n clockwise (Figure 1). You are also...
分类:
其他好文 时间:
2014-07-09 10:00:13
阅读次数:
172
Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a ...
分类:
其他好文 时间:
2014-07-08 21:44:23
阅读次数:
177
Description
Imagine you are standing inside a two-dimensional maze composed of square cells which may or may not be filled with rock. You can move north, south, east or west one cell at a step. T...
分类:
其他好文 时间:
2014-07-08 21:04:29
阅读次数:
347
The Lost House
Time Limit: 3000MS
Memory Limit: 30000K
Total Submissions: 2140
Accepted: 886
Description
One day a snail climbed up to a big tree and finally came to th...
分类:
其他好文 时间:
2014-07-08 18:08:00
阅读次数:
267
Singleton is one design pattern in the software engineering. Ruby has its own special feature to declare singleton class...
分类:
其他好文 时间:
2014-07-08 18:05:25
阅读次数:
213
尽管C语言的数组会让新手感到麻烦,然而C语言中数组的这种特别的设计正是其最大优势所在。要理解这一点,以下是一些简单解释。
在所有常见的程序设计错误中,最难于察觉的一类是“栏杆错误”,也常被称为“差一错误”(off-by-one error)。例如这个问题:100英尺长的围栏每隔10英尺需要一根支撑用的栏杆,一共需要多少根栏杆呢?如果不加思索,大家会容易以为是100除以10,即为10...
分类:
编程语言 时间:
2014-07-08 17:00:16
阅读次数:
269
Description
Let’s play a puzzle using eight cubes placed on a 3 × 3 board leaving one empty square.
Faces of cubes are painted with three colors. As a puzzle step, you can roll one of the cubes ...
分类:
其他好文 时间:
2014-07-08 16:27:42
阅读次数:
220
Method 1: Add one list into the other list.
For example, if list1is {22, 33, 44, 55} and list2 is {66, 77, 88, 99},then append(list1, list2)will change list1to {22, 33, 44, 55, 44, 66, 77, 88, 99}.
...
分类:
其他好文 时间:
2014-07-08 16:18:22
阅读次数:
196
def MirroRecursively(root):
# root is None or just one node, return root
if None == root or None == root.left and None == root.right:
return root
root.left, root.right = root.right, root.left
Mi...
分类:
其他好文 时间:
2014-07-08 14:26:08
阅读次数:
221