摘要:
create a new react project: ''' npm create vite@latest cd folderName nom i ''' 阅读全文
摘要:
84.柱状图中最大的矩形 class Solution: def largestRectangleArea(self, heights: List[int]) -> int: s = [0] result = 0 heights.insert(0,0) heights.append(0) for i 阅读全文
摘要:
503.下一个更大元素II class Solution: def nextGreaterElements(self, nums: List[int]) -> List[int]: dp = [-1] * len(nums) stack = [] for i in range(len(nums)*2 阅读全文
摘要:
739. 每日温度 单调栈指的是只增加或只减少的stack,相当于一个memo class Solution: def dailyTemperatures(self, temperatures: List[int]) -> List[int]: answer = [0] * len(temperat 阅读全文
摘要:
**416. 分割等和子集 ** class Solution: def canPartition(self, nums: List[int]) -> bool: _sum = 0 dp = [0]*10001 for num in nums: _sum += num if _sum % 2 == 阅读全文
摘要:
343. 整数拆分 class Solution: def integerBreak(self, n: int) -> int: dp = [0] * (n+1) dp[2] = 1 for i in range(3, n+1): for j in range(1, i//2+1): dp[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 阅读全文