栈
文章平均质量分 70
益达915
一名在读大学生,渣渣一枚,进取中...
展开
-
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 of each ba原创 2016-08-24 16:29:42 · 268 阅读 · 0 评论 -
LeetCode | 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 example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1原创 2016-08-24 18:13:38 · 353 阅读 · 0 评论 -
LeetCode 32. Longest Valid Parentheses
问给出一串括号 ()))(())..,最长的valid括号组合有多长?(括号组合需要连续) 这道题确实比较麻烦,在这里记录一下错误思路: ①想到的是这道题应该可以用dp做。设dp[i][j]代表从s[i..j]中valid括号组合最大长度。然后如果: s[i] == '(' and s[j] == ')' 岂不是就可以转化成dp[i+1][j-1]的问题。dp方程是dp[i][j]=dp原创 2018-02-02 22:35:52 · 142 阅读 · 0 评论