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-07-06 19:44:47
阅读次数:
115
Red and BlackTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uDescriptionThere is a rectangular room, covered with square tiles. Each...
分类:
其他好文 时间:
2015-07-06 17:31:35
阅读次数:
139
Largest NumberGiven a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9], the larg...
分类:
编程语言 时间:
2015-07-06 14:09:52
阅读次数:
130
这道题有两个做法 总体来说都是O(n) 但是第二个方法是第一个的简化版方法一:l[i] = max(j) 其中a[j], a[j+1], ...,a[i-1] a[i+1], ... ,a[j]dif[i] = r[i] - l[i]area[i] = a[i] * dif[i]最大的area[i....
分类:
其他好文 时间:
2015-07-06 07:46:29
阅读次数:
109
题目:输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个。例如输入数组{3,32,321},则打印出这3个数字能排成的最小数字321323.参见LeetCode-Largest Number。
分类:
编程语言 时间:
2015-07-05 18:16:56
阅读次数:
107
我会说我直接用了 heapq这么无耻的方法吗 :) 这道题应该直观用heap 复杂度为O(nlgk)1 import heapq2 class Solution:3 # @param {integer[]} nums4 # @param {integer} k5 # @ret...
分类:
其他好文 时间:
2015-07-04 13:53:51
阅读次数:
112
首先从介绍了Large_margin Separating Hyperplane的概念。(在linear separable的前提下)找到largest-margin的分界面,即最胖的那条分界线。下面开始一步步说怎么找到largest-margin separating hyperplane。接下来...
分类:
系统相关 时间:
2015-07-02 22:21:01
阅读次数:
239
题意: 求最大矩形面积。思路: 维护单调递增的矩形高度,当出现不能维护单调性的数加入时,开始维护面积累计ans ans = max{ans , 当前矩形高度×当前位置到最右的宽度};最后再加入0,清空栈。ps:跪jzt学长/。\ 1 #include 2 #include 3 using na...
分类:
其他好文 时间:
2015-07-02 15:18:06
阅读次数:
124
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.
For example, given the following matrix:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
...
分类:
其他好文 时间:
2015-07-02 10:07:01
阅读次数:
115
题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=1506题目大意: 给出一个数列An,问以Ai为最小值的区间内有多少个元素?解题思路: 手动模拟一个栈。栈内元素为一个单调不递减序列。当新元素Ai需要进栈,如果栈顶元素大于Ai,弹出栈顶元素,直到栈...
分类:
其他好文 时间:
2015-07-01 11:50:27
阅读次数:
111