原题地址假设我们找到了一个最优路径,那么该路径上一定存在一个节点,左边的路径是它的左儿子,右边的路径是它的右儿子。所以,只需要在遍历二叉树求路径的同时更新最大值即可。maxPath = max{只保留左边路径,只保留右边路径,同时保留左右两边路径,左右两边路径都不保留(只有节点本身)},对应第8行无...
分类:
其他好文 时间:
2015-01-21 13:18:39
阅读次数:
118
题目链接:点击打开链接
题目信息:
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 ...
分类:
其他好文 时间:
2015-01-20 22:13:22
阅读次数:
210
题目描述:给出一个没有排序的数组,找出这个数组中数字排序之后相邻元素的最大差值给出的数字都是整数,且范围在32位整数范围内要求时间复杂,空间复杂度都是线性复杂度题目分析:最简单的方法就是排序之后,找相邻元素之间的最大差值但是时间复杂度为 O(nlogn)这个题考察的是排序之后的情况,那么看来还是要适...
分类:
其他好文 时间:
2015-01-20 13:36:56
阅读次数:
86
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 ...
分类:
其他好文 时间:
2015-01-19 23:32:53
阅读次数:
234
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to rea...
分类:
其他好文 时间:
2015-01-19 15:53:51
阅读次数:
122
simultaneous-build-throttle:
This is the maximum number of connections we can be building at any one time.
That is, the number of new connections that have been requested but aren’t yet available ...
分类:
其他好文 时间:
2015-01-19 10:56:40
阅读次数:
277
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 ...
分类:
其他好文 时间:
2015-01-18 13:00:09
阅读次数:
145
题目:
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,?...
分类:
其他好文 时间:
2015-01-18 11:53:17
阅读次数:
103
题目:
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your...
分类:
编程语言 时间:
2015-01-17 18:12:27
阅读次数:
239
题目:
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Dete...
分类:
编程语言 时间:
2015-01-17 13:59:48
阅读次数:
200