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.
/**
* Definition for binary tree
*...
分类:
其他好文 时间:
2015-01-14 12:49:54
阅读次数:
131
问题描述:
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.
Try to solve it in linear time/space.
Return 0 if the array contains less than 2 ele...
分类:
其他好文 时间:
2015-01-13 23:17:46
阅读次数:
330
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] ha...
分类:
其他好文 时间:
2015-01-13 21:46:20
阅读次数:
181
题目;uva10827-Maximum sum on a torus(矩阵最大和的变形)题目大意:就是uva108的变形,矩阵能够连通,就是能够从后面连到前面。这里把矩阵复制三遍,然后又一次生成一个大的矩阵,就能够解决联通的问题。再枚举矩阵的起点和终点全部情况,保留最大值就能够了。比如:1 2 3 ...
分类:
其他好文 时间:
2015-01-13 21:21:05
阅读次数:
113
这题很难,主要是我没理解题目的意思,后来看着给的测试参考,和网上找的答案,终于理解了。 例如: 给的 正确的路线应该是 也就是说,路径是一条的,不是有分叉的,之所以算出55是因为把>0的数都加上去了,这样路径就分叉了,就不是一条路径了,所以用dfs做时,返回值应该是左子树或者右子树中>0且比较大的那...
分类:
其他好文 时间:
2015-01-13 21:17:50
阅读次数:
127
Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.两层循环,将在同一直线上的点放入hash table,找到hash table中的最大值。 1 int m...
分类:
其他好文 时间:
2015-01-13 19:36:55
阅读次数:
95
width - viewport的宽度 height - viewport的高度initial-scale - 初始的缩放比例minimum-scale - 允许用户缩放到的最小比例maximum-scale - 允许用户缩放到的最大比例user-scalable - 用户是否可以手动缩放width...
分类:
Web程序 时间:
2015-01-13 17:21:46
阅读次数:
157
题意:
给一个字符串,然后找一个子串,使子串满足其中连续重复子串最多。
比如ababab,重复次数为3,ababa,重复次数为1(abab是两次)
恶心在于还要输出最小字典序。
题解网上都有,不发了。
代码:
#include
#include
#include
#include
#define N 101000
#define LOGN 20
#define...
分类:
编程语言 时间:
2015-01-13 15:58:20
阅读次数:
256
https://oj.leetcode.com/problems/maximum-depth-of-binary-tree/Given a binary tree, find its maximum depth.The maximum depth is the number of nodes alo...
分类:
其他好文 时间:
2015-01-13 14:13:55
阅读次数:
105
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.
Try to solve it in linear time/space.
Return 0 if the array contains less than 2 elements.
Y...
分类:
编程语言 时间:
2015-01-12 22:34:27
阅读次数:
274