摘要: 方法一: 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) 编辑
摘要: 题目描述: 方法一:dfs class Solution: def numIslands(self, grid: List[List[str]]) -> int: def dfs(grid,r,c): nr = len(grid) nc = len(grid[0]) if r<0 or c<0 or 阅读全文
posted @ 2019-07-30 15:46 oldby 阅读(255) 评论(0) 推荐(0) 编辑