摘要: 题目 134 Gas Station这道题有一个需要利用的条件即是如果存在这样一个station则答案唯一。class Solution: # @param {integer[]} gas # @param {integer[]} cost # @return {integer} ... 阅读全文
posted @ 2015-07-13 14:40 dapanshe 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目:236 Lowest Common Ancestor of a Binary Tree这道题和 235基本一样class Solution: # @param {TreeNode} root # @param {TreeNode} p # @param {TreeNode} ... 阅读全文
posted @ 2015-07-13 14:16 dapanshe 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 题目235 Lowest Common Ancestor of a Binary Search Tree因为是binary search tree,因此利用没个节点的值进行二分查找即可复杂度O(h)class Solution: # @param {TreeNode} root # @p... 阅读全文
posted @ 2015-07-13 07:38 dapanshe 阅读(106) 评论(0) 推荐(0) 编辑