GoLang Solution For LeetCode Problem: Maximum Difference Between Node and Ancestor
Solving Maximum Difference Between Node and Ancestor in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.
(A node A is an ancestor of B if either: any child of A is equal to B, or any child of A is an ancestor of B.)
Input: [8,3,10,1,6,null,14,null,null,4,7,13] Output: 7 Explanation: We have various ancestor-node differences, some of which are given below : |8 - 3| = 5 |3 - 7| = 4 |8 - 1| = 7 |10 - 13| = 3 Among all possible differences, the maximum value of 7 is obtained by |8 - 1| = 7.
See the full details of the problem Maximum Difference Between Node and Ancestor at LeetCode
Originally posted at: @github.com/halfrost/LeetCode-Go