摘要: 题目描述: 方法:从后向前dp class Solution(object): def stoneGameIII(self, A): n = len(A) dp = [-float('inf')] * n for i in range(n-1,-1,-1): dp[i] = max(dp[i], s 阅读全文
posted @ 2020-04-05 19:32 oldby 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 第一次提交 python: class Solution: def longestDiverseString(self, a: int, b: int, c: int) -> str: res = "" l = [["a", a], ["b", b], ["c", c]] l.sort( 阅读全文
posted @ 2020-04-05 19:07 oldby 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 排序加后缀和 class Solution: def maxSatisfaction(self, satisfaction: List[int]) -> int: satisfaction.sort() t_s = 0 res = 0 for i in satisfaction[::-1 阅读全文
posted @ 2020-04-05 10:31 oldby 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 统计字符奇偶次数即可 class Solution: def canConstruct(self, s: str, k: int) -> bool: if k > len(s): return False c = collections.Counter(s) o = sum(i % 2 阅读全文
posted @ 2020-04-05 10:27 oldby 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 题目描述: class Solution: def checkOverlap(self, radius: int, x_center: int, y_center: int, x1: int, y1: int, x2: int, y2: int) -> bool: a = max(0, x1 - x 阅读全文
posted @ 2020-04-05 10:23 oldby 阅读(222) 评论(0) 推荐(0) 编辑