摘要: 题目描述: 方法一:动态规划 class Solution: def f(self, n, m): if n < m: n, m = m, n if (n, m) in self.mem: return self.mem[(n, m)] if n == m: ans = 1 else: ans = 阅读全文
posted @ 2019-10-28 14:21 oldby 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交:O(2**n∗n∗m),m 为字符串长度 class Solution: def maxLength(self, arr: List[str]) -> int: from collections import Counter if not arr:return 0 res = 阅读全文
posted @ 2019-10-28 14:11 oldby 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 参考格雷编码: class Solution: def circularPermutation(self, n: int, start: int) -> List[int]: res = [] for i in range(2 ** n): res.append((i >> 1) ^ i 阅读全文
posted @ 2019-10-28 10:08 oldby 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 题目描述: class Solution: def findSolution(self, customfunction: 'CustomFunction', z: int) -> List[List[int]]: res = [] for i in range(1,1001): for j in r 阅读全文
posted @ 2019-10-28 10:01 oldby 阅读(164) 评论(0) 推荐(0) 编辑