摘要:
84.柱状图中最大的矩形 class Solution: def largestRectangleArea(self, heights: List[int]) -> int: s = [0] result = 0 heights.insert(0,0) heights.append(0) for i 阅读全文
摘要:
62.不同路径 class Solution: def uniquePaths(self, m: int, n: int) -> int: table = [[0]*n]*m for x in range(n): table[0][x] = 1 for y in range(m): table[y] 阅读全文
摘要:
理论基础 斐波那契数 class Solution: def fib(self, n: int) -> int: if n == 0: return 0 if n == 1: return 1 return self.fib(n-1)+self.fib(n-2) 爬楼梯 class Solution 阅读全文
摘要:
738.单调递增的数字 class Solution: def monotoneIncreasingDigits(self, n: int) -> int: strNum = list(str(n)) for i in range(len(strNum)-1, 0, -1): if strNum[i 阅读全文
摘要:
435. 无重叠区间 class Solution: def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int: count = 0 intervals.sort(key=lambda x: x[0]) for i in r 阅读全文