Fork me on GitHub
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 思路: 由于是有序数组,那么根节点肯定是中间的那个数字,然后递归处理左子树和右子树即可。 阅读全文
posted @ 2017-03-23 16:53 hellowOOOrld 阅读(170) 评论(0) 推荐(0)
摘要: Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some starting node to any node in th 阅读全文
posted @ 2017-03-23 15:18 hellowOOOrld 阅读(160) 评论(0) 推荐(0)