<s> class TreeNode : <EOL> def __init__ ( self , x ) : <EOL> self . val = x <EOL> self . left = None <EOL> self . right = None <EOL> class Solution : <EOL> maxSum = float ( "<STR_LIT>" ) <EOL> def maxPathSum ( self , root ) : <EOL> self . maxPathSumRecu ( root ) <EOL> return self . maxSum <EOL> def maxPathSumRecu ( self , root ) : <EOL> if root is None : <EOL> return <NUM_LIT:0> <EOL> left = max ( <NUM_LIT:0> , self . maxPathSumRecu ( root . left ) ) <EOL> right = max ( <NUM_LIT:0> , self . maxPathSumRecu ( root . right ) ) <EOL> self . maxSum = max ( self . maxSum , root . val + left + right ) <EOL> return root . val + max ( left , right ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> root = TreeNode ( <NUM_LIT:1> ) <EOL> root . left = TreeNode ( <NUM_LIT:2> ) <EOL> root . right = TreeNode ( <NUM_LIT:3> ) <EOL> result = Solution ( ) . maxPathSum ( root ) <EOL> print result </s>
