Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist ...
分类:
其他好文 时间:
2016-12-23 01:19:30
阅读次数:
137
【题目分析】 本来是单调栈的题目,用笛卡尔树可以快速的水过去。 把每一个矩阵看成一个二元组(出现的顺序,高度)。 然后建造笛卡尔树。 神奇的发现,每一个节点的高度*该子树的大小,就是这一块最大的子矩阵的可能解。 用二元组的第一个下标来限制,使它们在一块儿,然后堆的性质又限制了宽度以及高度。 计算,取 ...
分类:
其他好文 时间:
2016-12-21 02:00:46
阅读次数:
145
1. Maximum Subarray (#53) Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given ...
分类:
其他好文 时间:
2016-12-17 11:39:35
阅读次数:
188
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 formed n ...
分类:
其他好文 时间:
2016-12-16 07:59:19
阅读次数:
184
refer to https://discuss.leetcode.com/topic/36995/share-my-o-n-java-code-with-brief-explanation-and-comments/2 这道题不好从root到leaf一层一层限制subtree取值范围,因为有可能p ...
分类:
其他好文 时间:
2016-12-15 07:36:46
阅读次数:
263
85. Maximal Rectangle Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. For exampl ...
分类:
其他好文 时间:
2016-12-12 14:08:17
阅读次数:
154
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],th ...
分类:
其他好文 时间:
2016-12-12 01:36:49
阅读次数:
186
原题描述 Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the ...
分类:
其他好文 时间:
2016-12-07 01:24:20
阅读次数:
294
题目要求 右边大数组中包含了4个小数组,分别找到每个小数组中的最大值,然后把它们串联起来,形成一个新数组。 提示:你可以用for循环来迭代数组,并通过arr[i]的方式来访问数组的每个元素。 答题思路 答案 function largestOfFour(arr) { // You can do th ...
分类:
其他好文 时间:
2016-12-05 16:58:28
阅读次数:
143
Binary Search Solution(+greedy) refer to https://discuss.leetcode.com/topic/61324/clear-explanation-8ms-binary-search-java 我的DP解法,skip了几个MLE的big case之 ...
分类:
其他好文 时间:
2016-12-05 07:48:38
阅读次数:
337