I get a lot of runtime errors. I get so frustrated. So finally, I just add the following code:
class Solution: # @param root, a tree node # @return an integer def maxPathSum(self, root): if root == None: return 0 def dfs(node): if node == None: return if node.left: dfs(node.left) if node.right: dfs(node.right) dfs(root)
It still gives me runtime error. I would expect at least a wrong answer. Anyone knows why?