
leetcode
YouMayLike
这个作者很懒,什么都没留下…
展开
-
[Leetcode]Trapping Rain Water - 递减栈
class Solution {public: int trap(int A[], int n) { int top=0; if(n<3) return 0; s[top++]=0; int res=0,t=0,pre=0; for(int i=1;i<n;i++) {原创 2014-05-15 21:33:08 · 1590 阅读 · 0 评论 -
[Leetcode]Largest Rectangle in Histogram - 非递减栈(递增及相等)
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 histogram.Above is a histogram where width o原创 2014-05-16 15:10:06 · 697 阅读 · 0 评论