I got wrong answer for my code.

Input: {1,-2,-3,1,3,-2,#,-1}

Output: 4

Expected: 3

If a path is from any node to any node, then node 1 and node 3 should give the biggest sum.

I used a stack to implement dfs

```
class Solution {
public:
int maxPathSum(TreeNode *root) {
if(root == NULL) return -INT_MAX;
stack<TreeNode*> s;
int max_to_here = 0;
int cur_max = -INT_MAX;
s.push(root);
while(!s.empty())
{
TreeNode *node = s.top();
s.pop();
if(node!=NULL)
{
int temp_max = max_to_here + node->val;
max_to_here = std::max(temp_max, node->val);
if(max_to_here > cur_max)
{
cur_max = max_to_here;
}
s.push(node->left);
s.push(node->right);
}
}
return cur_max;
}
};
```