I write a recursive solution in Python refer to a C++ recursive solution in "Discuss" page.

But i got Runtime error but not TLE. Can anyone tell me why?

Code is below:

```
class Solution:
# @param root, a tree node
# @return an integer
def maxPathSum(self, root):
def rec(node, maxval):
if node == None:
return 0,0
l = max(0, rec(node.left, maxval)[0])
r = max(0, rec(node.right, maxval)[0])
maxval = max(maxval, l + r + node.val)
return max(l, r)+node.val, maxval
return rec(root, -2147483648)[1]
```

I know recursive is not very efficient. So i wanted to solve this problem first and then optimize it.

I can accept TLE, Runtime error is unexpected...