class Solution { public int largestRectangleArea(int[] heights) { Stack stack=new Stack(); int maxArea=0; for(int i=0;i<=heights.length;i++) { int h=i... ...
分类:
其他好文 时间:
2017-09-28 09:50:47
阅读次数:
155
You are given n numbers. Store them in a list and find the second largest number. ...
分类:
编程语言 时间:
2017-09-26 13:09:31
阅读次数:
120
https://leetcode.com/problems/largest-palindrome-product/description/ ...
分类:
其他好文 时间:
2017-09-25 19:53:18
阅读次数:
123
堆排序 堆节点的访问 通常堆是通过一维数组来实现的。在数组起始位置为0的情形中: 父节点i的左子节点在位置(2*i+1); 父节点i的右子节点在位置(2*i+2); 子节点i的父节点在位置floor((i-1)/2); 堆的操作 在堆的数据结构中,堆中的最大值总是位于根节点(在优先队列中使用堆的话堆 ...
分类:
编程语言 时间:
2017-09-25 11:30:15
阅读次数:
237
堆排序做的,没有全部排序,找到第k个就结束 ...
分类:
编程语言 时间:
2017-09-21 22:24:07
阅读次数:
195
#week2# #from leetcode# Description Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For examp ...
分类:
其他好文 时间:
2017-09-18 00:18:48
阅读次数:
259
A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different h ...
分类:
其他好文 时间:
2017-09-15 20:59:45
阅读次数:
203
题文:https://vjudge.net/problem/UVA-11324 题解: 这个题目首先可以发现,只要是一个强连通分量,要么都选,要么都不选,将点权看成强连通分量的点数,所以这个题目就转化成了DAG上的最大路。 稍微dp一下就好了。 代码: ...
分类:
其他好文 时间:
2017-09-12 23:20:14
阅读次数:
547
找出多个数组中的最大数 右边大数组中包含了4个小数组,分别找到每个小数组中的最大值,然后把它们串联起来,形成一个新数组。 提示:你可以用for循环来迭代数组,并通过arr[i]的方式来访问数组的每个元素。 当你完成不了挑战的时候,记得开大招'Read-Search-Ask'。 找出多个数组中的最大数 ...
分类:
其他好文 时间:
2017-09-09 11:53:12
阅读次数:
147
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 ...
分类:
其他好文 时间:
2017-09-05 13:25:33
阅读次数:
239