上一页 1 2 3 4 5 6 7 8 9 ··· 47 下一页
摘要: 题目描述: 提交:二分 O(nlogk) class Solution: def minDays(self, bloomDay: List[int], m: int, k: int) -> int: minday = min(bloomDay) maxday = max(bloomDay) def 阅读全文
posted @ 2020-06-17 20:20 oldby 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 方法:动态规划 class Solution: def minDistance(self, houses: List[int], k: int) -> int: houses.sort() n = len(houses) cost = [[0]*n for _ in range(n)] for i 阅读全文
posted @ 2020-06-17 19:33 oldby 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 提交: class Solution: def finalPrices(self, prices: List[int]) -> List[int]: res = [] for i in range(len(prices)): for j in range(i,len(prices)): 阅读全文
posted @ 2020-06-17 17:46 oldby 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 提交: class SubrectangleQueries: def __init__(self, rectangle: List[List[int]]): self.list = rectangle def updateSubrectangle(self, row1: int, col1: int 阅读全文
posted @ 2020-06-17 17:44 oldby 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 阅读全文
posted @ 2020-06-15 23:34 oldby 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 方法一:dp+前缀和 O(N) class Solution: def minSumOfLengths(self, arr: List[int], target: int) -> int: n = len(arr) # dp[i]记录从第i个元素(包含第i个)往前找到的和为target最短子数组长度 阅读全文
posted @ 2020-06-15 10:42 oldby 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 解法一:二分法 提交:O(nlogn) class Solution: def findBestValue(self, arr: List[int], target: int) -> int: def helper(num): res = 0 for i in arr: if i > n 阅读全文
posted @ 2020-06-14 23:50 oldby 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 题目描述: class Solution: def minCost(self, houses: List[int], cost: List[List[int]], m: int, n: int, target: int) -> int: fcur = [[-1] * n for _ in range 阅读全文
posted @ 2020-06-11 11:10 oldby 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 提交: class BrowserHistory: def __init__(self, homepage: str): self.list = [homepage] self.cur = 0 def visit(self, url: str) -> None: if self.cur 阅读全文
posted @ 2020-06-11 10:51 oldby 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 提交: class Solution: def getStrongest(self, arr: List[int], k: int) -> List[int]: arr = sorted(arr) m = arr[(len(arr) - 1) // 2] res = [] tmp = s 阅读全文
posted @ 2020-06-11 10:46 oldby 阅读(125) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 47 下一页