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 [2,3] has the largest ...
分类:
其他好文 时间:
2015-03-27 22:28:08
阅读次数:
211
题目描述:Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest form...
分类:
其他好文 时间:
2015-03-22 01:38:59
阅读次数:
105
http://acm.hdu.edu.cn/showproblem.php?pid=4268
Problem Description
Alice and Bob's game never ends. Today, they introduce a new game. In this game, both of them have N different rectangular ca...
分类:
其他好文 时间:
2015-03-21 11:17:51
阅读次数:
150
Maximum Product Subarray问题:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, gi...
分类:
其他好文 时间:
2015-03-21 11:03:59
阅读次数:
135
This is the extension of Largest Rectangle in Histogram. We can just project 2D matrix to 1D array and compute it line by line. 1 class Solution { 2 p...
分类:
其他好文 时间:
2015-03-21 06:20:44
阅读次数:
121
Use two vector to record left and right indexes that can extend the blocks. 1 class Solution { 2 public: 3 int largestRectangleArea(vector &height...
分类:
其他好文 时间:
2015-03-20 08:02:31
阅读次数:
126
Corner case: when all the elements are 0. It should return "0", not "00000000".It use string to compare all the numbers. 1 class Solution { 2 public: ...
分类:
其他好文 时间:
2015-03-20 06:58:14
阅读次数:
109
题目描述: Largest Number Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9],...
分类:
其他好文 时间:
2015-03-19 20:04:12
阅读次数:
129
Largest Number问题:Given a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9], the l...
分类:
其他好文 时间:
2015-03-19 14:41:16
阅读次数:
127
题意:给出n个矩形的高,问它们能组成的最大矩形的面积是多少。
思路:定义两个数组 l[i] 和 r[i] ,分别记录从 i 点能向左向右扩展的最大位置。若a[i]<=a[ l[i] - 1 ],则 l[i] = l[ l[i] - 1](如果i可以扩展到l[i]-1处,那么在计算i之前l[i]-1处的l[l[i]-1]已经计算出来了,就可以直接令l[i]=l[l[i]-1]了);同理,若 a[i]<=a[ r[i] - 1 ],则 r[i] = r[ r[i] - 1]。这样做充分利用了之前已经计算出来的数...
分类:
其他好文 时间:
2015-03-19 13:22:25
阅读次数:
127