摘要: 哈希表 关联数组(Associative Array),映射(Map),特征表(Symbol Table),字典( Dictionary) 可作为哈希的对象是不能改变的,string,int,float,tuple,object set,dict,list可以改变不能作为key,想将list放入哈希 阅读全文
posted @ 2019-12-24 18:50 oldby 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 提交: # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def getDec 阅读全文
posted @ 2019-12-24 14:35 oldby 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交: class Solution: def sequentialDigits(self, low: int, high: int) -> List[int]: l,h = len(str(low)),len(str(high)) res = [] def helper(num, 阅读全文
posted @ 2019-12-24 14:30 oldby 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 题目描述; 自己的提交:超时 class Solution: def maxSideLength(self, mat: List[List[int]], threshold: int) -> int: m,n = len(mat),len(mat[0]) res = 0 for i in range 阅读全文
posted @ 2019-12-24 14:19 oldby 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 自己的提交:广度优先 O(mn*min(k,m+n)) class Solution: def shortestPath(self, grid, k: int) -> int: visited = {} queue = [[0,0,k-1]]if grid[0][0] == 1 and 阅读全文
posted @ 2019-12-24 11:32 oldby 阅读(473) 评论(0) 推荐(0) 编辑