这两道题用递归的解法都很简单,只是稍有不同。下面是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
不断递归的实现!!!!下面是AC代码: 1 /** 2 * Given inorder and
postorder traversal of a tree, construct the binary tree. 3 * @param inorder 4 *
@param...
分类:
其他好文 时间:
2014-05-10 08:40:40
阅读次数:
297
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
Description Given a code (not optimized), and
necessary inputs, you have to find the output of the code for the inputs. The
code is as follows: int a,...
分类:
其他好文 时间:
2014-05-07 09:56:16
阅读次数:
310
Given a binary tree, find the maximum path
sum.The path may start and end at any node in the tree.For example:Given the
below binary tree, 1 ...
分类:
其他好文 时间:
2014-05-07 09:36:09
阅读次数:
300
验证二叉树是否是查找树,可以通过查看它的中序遍历是否是升序的。下面是AC代码: 1 /** 2 *
Given a binary tree, determine if it is a valid binary search tree (BST). 3 *
solution : 4...
分类:
其他好文 时间:
2014-05-07 09:01:45
阅读次数:
250
Problem Description
You are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ≤ ...
分类:
其他好文 时间:
2014-05-07 07:59:11
阅读次数:
309
题目链接:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1836
Number Puzzle
Time Limit: 2 Seconds Memory Limit: 65536 KB
Given a list of integers (A1, A2, ..., An), and a posi...
分类:
其他好文 时间:
2014-05-07 07:42:49
阅读次数:
332
【Question】
Given an array S of n integers, are there elements a, b, c in S such
that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in ...
分类:
其他好文 时间:
2014-05-06 14:57:29
阅读次数:
318
1、到今天完成39题,还需要不停的加油。今天再分析下装雨水这道题Given n
non-negative integers representing an elevation map where the width of each bar
is 1, compute how much water i...
分类:
移动开发 时间:
2014-05-06 14:08:48
阅读次数:
490