[Leetcode] Binary Tree Maximum Path Sum

Question:

Given a binary tree, find the maximum path sum.

The path may start and end at any node in the tree.

For example:
Given the below binary tree,

       1
      / \
     2   3

 

Return 6.

给出一个二叉树,找到其中的最大路径和。

路径可以从树中任意一个节点开始和结束。

例如:

给出如下二叉树,

       1

      / \

    2    3

返回6

 

posted @ 2014-06-13 18:56  Phoebe815  阅读(142)  评论(0)    收藏  举报