1、Maximum Depth of Binary Tree
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.
clas...
分类:
其他好文 时间:
2014-06-02 23:13:22
阅读次数:
290
并查集。需要考虑入度。 1 #include 2 #include 3 4 #define
MAXNUM 10005 5 6 int bin[MAXNUM]; 7 int degree[MAXNUM]; 8 int nums[MAXNUM]; 9 10
int find(int x) {11...
分类:
其他好文 时间:
2014-06-02 21:31:31
阅读次数:
219
先上题目:Find NumbersTime Limit: 10000/5000 MS
(Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s):
26Accepted Submission(s): 20Spec...
分类:
其他好文 时间:
2014-06-02 17:15:22
阅读次数:
267
3-sum
题目描述:
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.
题目要求:
Elements...
分类:
其他好文 时间:
2014-06-01 17:31:27
阅读次数:
471
利用windows的API,FindFirstFile和FileNextFile,采用递归遍历指定文件夹中的所有文件及文件夹,第一次windows编程,代码写的很臃肿难看,请大家多多包涵!
#include
#include
#include
#include
#define MAXN 100005
using namespace std;
void surf(WIN32_FIND_DAT...
【题目】
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,3,2].
Note: Recursive solution is trivial, could you do it iteratively?
confused what "{1,#,2...
分类:
其他好文 时间:
2014-06-01 13:01:23
阅读次数:
279
Dungeon MasterTime Limit: 1000MSMemory Limit:
65536KTotal Submissions: 15868Accepted: 6162DescriptionYou are trapped in a 3D
dungeon and need to find ...
分类:
其他好文 时间:
2014-06-01 12:16:08
阅读次数:
147
Find The MultipleTime Limit: 1000MSMemory
Limit: 10000KTotal Submissions: 16995Accepted: 6921Special JudgeDescriptionGiven
a positive integer n, write...
分类:
其他好文 时间:
2014-06-01 11:27:41
阅读次数:
176
【题目】
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.
Above is a histogram where width of each bar is 1, given height = [2,1,5,6,2,3].
The...
分类:
其他好文 时间:
2014-06-01 10:46:29
阅读次数:
242
title:
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
翻译:
10以下的质数的和为2 + 3 + 5 + 7 = 17。
请求出200,0000以下所有质数的和。
import math,time
d...
分类:
其他好文 时间:
2014-06-01 09:12:31
阅读次数:
239