摘要: Closest Binary Search Tree Value II 要点:通过iterator,把closest值附近的k个closest找到,从而time降为O(klgn) in order iterator的本质:栈存当前见到,未来还要再访问到的node。当前见到是沿着left访问,而未来再 阅读全文
posted @ 2016-07-25 19:29 absolute100 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Closest Binary Search Tree Value 要点: https://repl.it/CfhL/1 Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val 阅读全文
posted @ 2016-07-25 19:29 absolute100 阅读(90) 评论(0) 推荐(0) 编辑