摘要: 题目描述: 方法:欧拉回路 dfs class Solution: def findItinerary(self, tickets: List[List[str]]) -> List[str]: d = collections.defaultdict(list) for f,t in tickets 阅读全文
posted @ 2019-10-14 19:55 oldby 阅读(307) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法: class Solution(object): def maxEqualFreq(self, A): count = collections.Counter() freqs = collections.Counter() ans = 1 for i, x in enumerate 阅读全文
posted @ 2019-10-14 10:46 oldby 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法:动态规划O(6∗6∗n∗15) 递归: from functools import lru_cache class Solution: def dieSimulator(self, n, rollMax): MOD = 10 ** 9 + 7 @lru_cache(None) de 阅读全文
posted @ 2019-10-14 10:03 oldby 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交: class Solution: def queensAttacktheKing(self, queens: List[List[int]], king: List[int]) -> List[List[int]]: if not queens:return [] res = 阅读全文
posted @ 2019-10-14 08:59 oldby 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交: class Solution: def balancedStringSplit(self, s: str) -> int: if not s:return 0 res = 0 c = {} tmp = None for r in s: if not c: tmp = r c 阅读全文
posted @ 2019-10-14 08:43 oldby 阅读(212) 评论(0) 推荐(0) 编辑