int dfs(root): the max. length of one of substree.
i.e.
dfs(root):
if(root == null)
return 0
left += dfs(root->left)
right += dfs(root->right)
res = max(res, left + right + 1);
return max(left, right) + 1;
Error:
- calculate the path not the node, so we need to -1 at the end.