摘要: 使用哈希的方式,快速查找。 560 todo 如果用sum[level] -sum[j] (其中j = 0...level-1)的方式比较,时间复杂度为O(h^2)。空间复杂度为O(n) ,一个数组,用来存储每层的值。 注意在py中,用append ,而非直接索引[i+1],否则会越界。回溯的时候, 阅读全文
posted @ 2018-09-27 19:36 vector11248 阅读(142) 评论(0) 推荐(0)
摘要: # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # class Solution: # def hasPathS... 阅读全文
posted @ 2018-09-27 13:27 vector11248 阅读(176) 评论(0) 推荐(0)