Please Visit: http://ift.tt/1ajReyV
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/UCfMCZ
via LifeLong Community
My Leetcode: Binary Tree Maximum Path Sum (Java)
Preorderly traverse the whole tree. For each node calculate Max(root, root+leftSide, root+rightSide, leftSide+root+rightSide ), update max[0] (which is used to store max value), then return Max (root+leftSide, root+rightSide, root)
http://ift.tt/1uZ7aRF
http://ift.tt/UCfJHi
Preorderly traverse the whole tree. For each node calculate Max(root, root+leftSide, root+rightSide, leftSide+root+rightSide ), update max[0] (which is used to store max value), then return Max (root+leftSide, root+rightSide, root)
http://ift.tt/1uZ7aRF
http://ift.tt/UCfJHi
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/UCfMCZ
via LifeLong Community
No comments:
Post a Comment