这两道题用递归的解法都很简单,只是稍有不同。下面是AC代码: 1 /** 2 * Given a
binary tree, find its minimum depth. 3 * the minimum depth is the number of
nodes along th...
分类:
其他好文 时间:
2014-05-10 08:47:32
阅读次数:
271
Given two wordsword1andword2, find the minimum
number of steps required to convertword1toword2. (each operation is counted as 1
step.)You have the fol...
分类:
其他好文 时间:
2014-05-10 01:09:28
阅读次数:
325
DescriptionThe inversion number of a given
number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i
aj.For a given sequence of ....
分类:
其他好文 时间:
2014-05-05 11:42:13
阅读次数:
276
// test.cpp : Defines the entry point for the
console application.//#include "stdafx.h"#include #include #include
"winioctl.h"#define IOCTL_STORAGE_QU...
分类:
其他好文 时间:
2014-05-05 10:52:44
阅读次数:
370
linux系统下.vimrc文件(这个文件可以在家目录新建);这个文件记录着vim的配置信息;如:"显示行号set
number"键映射map“如按F5,在word的前后加入{}map i{ea}
分类:
其他好文 时间:
2014-05-05 10:12:32
阅读次数:
274
typeof用以获取一个变量或者表达式的类型,typeof一般只能返回如下几个结果:number,boolean,string,function(函数),object(NULL,数组,对象),undefined。如:alert(typeof
(123));//typeof(123)返回"number...
分类:
其他好文 时间:
2014-05-05 09:37:22
阅读次数:
435
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...
分类:
其他好文 时间:
2014-05-04 19:46:18
阅读次数:
372
Binary Stirling NumbersTime Limit:1000MSMemory
Limit:10000KTotal Submissions:1761Accepted:671DescriptionThe Stirling number of
the second kind S(n, m)...
分类:
其他好文 时间:
2014-05-04 19:34:32
阅读次数:
434
We consider permutations of the numbers 1,..., N
for some N. By permutation we mean a rearrangment of the
number 1,...,N. For example
2 4 5 1 7 6 3 8
is a permutation of 1,2,...,8. Of cours...
分类:
其他好文 时间:
2014-05-04 18:38:14
阅读次数:
341
题目描述:1038. Recover the Smallest Number
(30)Given a collection of number segments, you are supposed to recover the
smallest number from them. For examp...
分类:
其他好文 时间:
2014-05-04 10:49:34
阅读次数:
308