摘要: 题目描述: 动态规划:O(N^3) class Solution: def palindromePartition(self, s: str, k: int) -> int: def cost(i, j): r = 0 while i < j: if s[i] != s[j]: r += 1 i + 阅读全文
posted @ 2019-12-02 20:24 oldby 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交: class Solution: def countSquares(self, matrix: List[List[int]]) -> int: if not matrix: return 0 m,n = len(matrix),len(matrix[0]) dp = [0] 阅读全文
posted @ 2019-12-02 19:15 oldby 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交: class Solution: def numOfBurgers(self, tomatoSlices: int, cheeseSlices: int) -> List[int]: t = (tomatoSlices - 2 * cheeseSlices) / 2 c = 阅读全文
posted @ 2019-12-02 18:27 oldby 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交: class Solution: def tictactoe(self, moves: List[List[int]]) -> str: p = [[0] * 3 for _ in range(3)] if len(moves) < 5: return "Pending" f 阅读全文
posted @ 2019-12-02 18:24 oldby 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交: # """ # This is Sea's API interface. # You should not implement it, or speculate about its implementation # """ #class Sea(object): # def 阅读全文
posted @ 2019-12-02 13:21 oldby 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交:动态规划 class Solution: def deleteTreeNodes(self, nodes: int, parent: List[int], value: List[int]) -> int: dp = [[0, 0]for _ in range(nodes)] 阅读全文
posted @ 2019-12-02 12:42 oldby 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交: class Solution: def removeInterval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: res = [] for i in interv 阅读全文
posted @ 2019-12-02 12:30 oldby 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 自己的提交: class Solution: def toHexspeak(self, num: str) -> str: num = hex(int(num)) num = str(num)[2:] res = "" for i in num: if i == "0": i = "O" if i 阅读全文
posted @ 2019-12-02 12:24 oldby 阅读(217) 评论(0) 推荐(0) 编辑