Medium · Trees · about 15 minutes
Asked at Amazon, Google, Meta, Microsoft.
Return the maximum |a.val - b.val| over pairs of different nodes where a is an ancestor of b.
|a.val - b.val|
a
b