上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 47 下一页
摘要: 题目描述: 方法一: class Solution: def findMaximumXOR(self, nums: List[int]) -> int: root = TreeNode(-1) for num in nums: cur_node = root #当前的node for i in ra 阅读全文
posted @ 2019-10-03 09:50 oldby 阅读(389) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 第一次提交:(超出时间限制) class Solution: def findWords(self, board: List[List[str]], words: List[str]) -> List[str]: def dfs(word,i,j,visited): if len(wor 阅读全文
posted @ 2019-10-02 18:54 oldby 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一: class WordDictionary: def __init__(self): """ Initialize your data structure here. """ #from collections import defaultdict self.lookup = { 阅读全文
posted @ 2019-10-02 16:49 oldby 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一: class Trie: def __init__(self): """ Initialize your data structure here. """ self.tree = {} def insert(self, word: str) -> None: """ Insert 阅读全文
posted @ 2019-10-02 15:58 oldby 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 方法一:dfs class Solution: def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool: def dfs(i, adjacency, flags): if flags[i] 阅读全文
posted @ 2019-10-02 14:39 oldby 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 第一次提交: class Solution: def isIsomorphic(self, s: str, t: str) -> bool: dicA = {} dicB = {} for i in range(len(s)): if s[i] not in dicA: dicA[s[i 阅读全文
posted @ 2019-10-02 11:14 oldby 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 方法一: class Solution(object): def minimumSemesters(self, N, relations): """ :type N: int :type relations: List[List[int]] :rtype: int """ dic = {} dic2 阅读全文
posted @ 2019-07-30 17:15 oldby 阅读(322) 评论(0) 推荐(0) 编辑
摘要: 方法一: class Solution: def minimumCost(self, N: int, conections: List[List[int]]) -> int: def find(i): if father[i]==i: return i else: father[i]=find(fa 阅读全文
posted @ 2019-07-30 17:10 oldby 阅读(900) 评论(0) 推荐(0) 编辑
摘要: 第一次提交: class Solution: def isArmstrong(self, N: int) -> bool: n = N l = len(str(N)) res = 0 while N: a = N % 10 res += a**l N = N//10 if res == n: ret 阅读全文
posted @ 2019-07-30 16:13 oldby 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 第一次提交: class Solution: def largestUniqueNumber(self, A: List[int]) -> int: dict = {} for i in A: if i not in dict: dict[i] = 1 else: dict[i] += 1 res 阅读全文
posted @ 2019-07-30 16:10 oldby 阅读(294) 评论(0) 推荐(0) 编辑
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 47 下一页