题目描述:
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
解题思路:直接DFS。
代码:
/**...
分类:
其他好文 时间:
2014-10-24 13:04:21
阅读次数:
147
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous subarray [2,3] has the largest pr...
分类:
编程语言 时间:
2014-10-24 13:01:16
阅读次数:
222
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...
分类:
其他好文 时间:
2014-10-24 10:26:11
阅读次数:
269
题目:给你一组数,求出其中两两最大公约数中最大的值。
分析:数论。数据较小,直接枚举即可。
说明:注意输入格式。
#include
#include
#include
using namespace std;
int data[101];
int gcd(int a, int b)
{
return a%b?gcd(b, a%b):b;
}
int main()
{
int...
分类:
其他好文 时间:
2014-10-23 16:24:39
阅读次数:
348
Maximum Product SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given...
分类:
其他好文 时间:
2014-10-22 19:51:21
阅读次数:
272
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...
分类:
其他好文 时间:
2014-10-22 14:29:45
阅读次数:
171
Given a binary tree,find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest lea...
分类:
其他好文 时间:
2014-10-21 22:58:39
阅读次数:
235
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...
分类:
其他好文 时间:
2014-10-21 22:52:27
阅读次数:
278
采用的的是小牛的写法,蒟蒻第一次写。。
RMQ (Range Minimum/Maximum Query)问题是指:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j
这里介绍ST算法:采用动态规划的思想:详见
士兵杀敌(三)
时间限制:2000 ms | 内存限制:65535 KB
难度:5
描述
南将军统率着N个士兵,士兵分...
分类:
编程语言 时间:
2014-10-21 01:05:37
阅读次数:
227
题目描述:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4...
分类:
其他好文 时间:
2014-10-20 08:38:54
阅读次数:
125