Maximum difference between node and its ancestor
Given a Binary Tree you need to find maximum value which you can get by subtracting value of node B from value of node A, where A and B are two nodes of the binary tree and A is an ancestor of B.
Latest Source Code:
Github: BinaryTreeMaxNodeDiff.java
Output:
8 / \ / \ / \ / \ 3 10 / \ \ / \ \ 1 6 14 / \ / 4 7 13 Max diff: 7