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
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-12 13:07:22
阅读次数:
149
Easy Task
Time Limit: 2 Seconds Memory Limit: 65536 KB
You are given n integers. Your task is very easy. You should find the maximum integer a and the minimum integer b among these n inte...
分类:
其他好文 时间:
2015-01-11 20:24:46
阅读次数:
242
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...
分类:
其他好文 时间:
2015-01-11 12:11:44
阅读次数:
133
The problem 1: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 t...
分类:
其他好文 时间:
2015-01-11 06:07:49
阅读次数:
216
The problem: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,...
分类:
其他好文 时间:
2015-01-11 00:59:13
阅读次数:
287
虽然是两个水题,但是一次AC的感觉真心不错这个问题算是maximum-subarray问题的升级版,不过主要算法思想不变:1. maximum-subarray问题maximum-subarray就是找到数组A[1....n]中的连续子数组A[i.....j]并且A[i]+...+A[j]和最大。当...
分类:
其他好文 时间:
2015-01-10 16:32:04
阅读次数:
135
https://oj.leetcode.com/problems/maximum-product-subarray/http://blog.csdn.net/linhuanmars/article/details/39537283publicclassSolution{
publicintmaxProduct(int[]A)
{
if(A==null||A.length==0)
return0;
intlocalmin=1;
intlocalmax=1;
intglobal=Integer.MIN_VALU..
分类:
其他好文 时间:
2015-01-09 17:39:33
阅读次数:
127
Police raided his home in August and found more than 100g of marijuana. He faced a maximum sentence of three years.His arrest came amid a drug use cra...
分类:
其他好文 时间:
2015-01-09 17:05:54
阅读次数:
166