摘要: Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.找树的最大路径和 注意路径可以从任意点起始和结束。我发现我真的还挺擅长树的题目的,递归不难。就是因为有个... 阅读全文
posted @ 2014-11-27 22:46 匡子语 阅读(218) 评论(0) 推荐(0)
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST.有序数组变二叉平衡搜索树,不难,递归就行。每次先序建立根节点(取最中间的数),然后用子区间划分左右子树。一... 阅读全文
posted @ 2014-11-27 21:42 匡子语 阅读(197) 评论(0) 推荐(0)