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 le...
分类:
其他好文 时间:
2015-06-12 23:40:02
阅读次数:
121
题目链接 题目要求: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the ar...
分类:
其他好文 时间:
2015-06-12 11:29:03
阅读次数:
100
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2015-06-12 00:33:10
阅读次数:
122
题目链接 题目要求: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array[...
分类:
其他好文 时间:
2015-06-11 21:13:17
阅读次数:
105
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 a binary...
分类:
其他好文 时间:
2015-06-11 19:26:53
阅读次数:
126
Max TreeGiven an integer array with no duplicates. A max tree building on this array is defined as follow:The root is the maximum number in the arrayT...
分类:
其他好文 时间:
2015-06-11 18:58:01
阅读次数:
228
题目描述Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longes...
分类:
其他好文 时间:
2015-06-11 12:36:10
阅读次数:
110
Maximum Subarray IIIGiven an array of integers and a numberk, find knon-overlappingsubarrays which have the largest sum.The number in each subarray sh...
分类:
其他好文 时间:
2015-06-10 19:19:20
阅读次数:
170
1. 概述
RMQ(Range Minimum/Maximum Query),即区间最值查询,是指这样一个问题:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j当然,该问题也可以用线段树(也叫区间树)解决,算法复杂度为:O(N)~O(logN),这里我们暂不介绍。
2.RMQ算法
对于该问题,最容易想到的解决方案是遍历,复杂度是O(n)。但当数据量非常大...
分类:
编程语言 时间:
2015-06-10 17:25:58
阅读次数:
173
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-06-10 12:03:48
阅读次数:
88