这两道题用递归的解法都很简单,只是稍有不同。下面是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
这道题因为不仔细的缘故两次过,与Maximum Depth of Binary
Tree问题类似,区别在于这个问题中,如果一个节点左子树为空、右子树有值,则该节点的深度应取决于右子树,而不能直接取min{左,右} 1 /** 2 *
Definition for binary tree 3 * .....
分类:
其他好文 时间:
2014-05-10 01:40:13
阅读次数:
293
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
Given two words word1 and word2, find the
minimum number of steps required to convert word1 to word2. (each operation is
counted as 1 step.)You have t...
分类:
其他好文 时间:
2014-05-09 19:09:35
阅读次数:
318
Given a triangle, find the minimum path sum from
top to bottom. Each step you may move to adjacent numbers on the row below.For
example, given the fol...
分类:
其他好文 时间:
2014-05-08 21:08:25
阅读次数:
407
Given a triangle, find the minimum path sum
from top to bottom. Each step you may move to adjacent numbers on the row
below.For example, given the fol...
分类:
其他好文 时间:
2014-05-07 02:55:24
阅读次数:
377
老是报物理内存越界,kill
container,然后把yarn.scheduler.minimum-allocation-mb设成2048就好了跟这个yarn.nodemanager.pmem-check-enabled参数应该也有关系在这篇文章中得到启发:http://bise.aliapp.c...
分类:
其他好文 时间:
2014-05-07 02:15:35
阅读次数:
409
Unique MSTTime Limit: 3000/1000MS (Java/Others)
Memory Limit: 65535/65535KB (Java/Others)Given a connected undirected graph,
tell if its minimum span....
分类:
其他好文 时间:
2014-05-07 00:55:18
阅读次数:
530
minimum inversion number:最小逆序数Minimum Inversion
NumberTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K
(Java/Others)Total Submission(...
分类:
其他好文 时间:
2014-05-07 00:43:39
阅读次数:
469
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