题目链接:https://leetcode.com/problems/maximum-product-subarray/
题目:
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, give...
分类:
其他好文 时间:
2016-05-30 15:32:29
阅读次数:
139
给定一组非负整数,将这些整数拼接成最大的数字。由于返回的数字可能非常大,直接返回字符串。...
分类:
其他好文 时间:
2016-05-30 15:17:23
阅读次数:
136
Given an integer array, find the top k largest numbers in it. Example Given [3,10,1000,-99,4,100] and k = 3.Return [1000, 100, 10]. Given [3,10,1000,- ...
分类:
其他好文 时间:
2016-05-29 21:17:46
阅读次数:
169
又是一道构思巧妙的题,暴力求解复杂度太高,通过构造一个递增栈,O(n)就能解决问题,其中的过程值得细细体会。 int largestRect(vector<int> &height) { stack<int> s;//定义一个单调递增栈 height.push_back(0);//定义单调递增栈的最 ...
分类:
其他好文 时间:
2016-05-28 15:39:29
阅读次数:
151
Largest prime factor
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 10004 Accepted Submission(s): 3534
Problem Description
Ever...
分类:
其他好文 时间:
2016-05-27 12:29:18
阅读次数:
186
Largest prime factor Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9993 Accepted Submission(s): ...
分类:
其他好文 时间:
2016-05-23 17:22:10
阅读次数:
181
上一篇文章讲了该题的一个解法。后来又发现一个更好的解法。 首先依旧考虑一个升序的数列,例如1,2,3,4,5。那么它的最大矩形显然是有5种可能,即 1*5,2*4,3*3,4*2,1*5。所以最大的矩形为9。那么显然不可能是升序的数列。 依据以下几条规则对其进行处理。 有栈stack和待处理数组a[ ...
分类:
其他好文 时间:
2016-05-19 13:21:34
阅读次数:
157
题目信息1094. The Largest Generation (25)时间限制200 ms
内存限制65536 kB
代码长度限制16000 B
A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generat...
分类:
其他好文 时间:
2016-05-18 19:32:17
阅读次数:
200
直方图上的最大矩形。这道题很有意思。研究了半天才研究出来是个什么意思。 首先看题目: Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, fin ...
分类:
其他好文 时间:
2016-05-18 15:59:34
阅读次数:
183