07 2024 档案
摘要:LeetCode 3111 覆盖所有点的最少矩形数目 方法1:贪心 class Solution: def minRectanglesToCoverPoints(self, points: List[List[int]], w: int) -> int: lst = sorted(set(x for
阅读全文
摘要:LeetCode 2961 双模幂运算 方法1:快速幂 class Solution: def getGoodIndices(self, variables: List[List[int]], target: int) -> List[int]: ans = list() for i, (a, b,
阅读全文
摘要:牛客 23486 小A与小B 方法1:BFS from collections import deque from typing import List def bfs(pos: tuple, direction: int) -> List[List[int]]: ans = [[MAX] * M
阅读全文
摘要:LeetCode 682 棒球比赛 方法1:栈模拟 class Solution: def calPoints(self, operations: List[str]) -> int: nums = list(); ans = 0 for op in operations: if op == "+"
阅读全文
摘要:LeetCode 699 掉落的方块 方法1:暴力 class Solution: def fallingSquares(self, positions: List[List[int]]) -> List[int]: n = len(positions); ans = [0] * n # 记录每个方
阅读全文
摘要:LeetCode 3106 满足距离约束且字典序最小的字符串 方法1:贪心 class Solution: def getSmallestString(self, s: str, k: int) -> str: ans = list(s); res = ord('a') for i, x in en
阅读全文