CURRENCY CLOUD | Off-Campus OA (2022) | Maximum Difference Between Node and Ancestor
Question · Posted Jun 2026
Problem Statement You are given the root of a binary tree. For every node in the tree, any node present on the path from the root to that node is considered its ancestor. Your task is to find the maximum possible value of: ∣ancestor.val−node.val∣|ancestor.val - node.val|∣ancestor.val−node.val∣ where: ancestor is any ancestor of the current node. node is any descendant node. Return the maximum absolute difference between the value of a node and the value of one of its ancestors. Input ...
The full answer & interview discussion are available to premium members.
Log in Create a free account