摘要: 题目描述: 方法一:动态规划+使用柱状图的优化暴力方法 O(N*2M) O(NM) N为行数 class Solution: def maximalRectangle(self, matrix: List[List[str]]) -> int: maxarea = 0 dp = [[0] * len 阅读全文
posted @ 2019-10-23 21:38 oldby 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一:O(N) O(N) class Solution: def largestRectangleArea(self, heights: List[int]) -> int: if not heights: return 0 n = len(heights) left_i = [0] 阅读全文
posted @ 2019-10-23 13:41 oldby 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 第一次提交: class Solution: def trap(self, height: List[int]) -> int: res = 0 def helper(height): nonlocal res if len(height) <= 1: return queue = [] 阅读全文
posted @ 2019-10-23 12:36 oldby 阅读(140) 评论(0) 推荐(0) 编辑