result
to store the maximum difference found.helper(node, cur_max, cur_min)
that:
result
with the maximum of the current result
and the differences node.val - cur_min
and cur_max - node.val
.cur_max
and cur_min
accordingly.helper(root, root.val, root.val)
to start the recursion.result
after the recursion completes.