Given the root of a binary search tree, return the minimum absolute difference between the values of any two different nodes. Pattern focus: Inorder Gives Sorted Sequence. Because inorder traversal of a BST yields a sorted sequence, the minimum difference will be between adjacent values in that order.
root = binary tree root
minimum absolute difference between any two node values
Example 1:
Input:
root = [4,2,6,1,3]
Output:
1
Explanation:
Adjacent inorder values 1 and 2, or 2 and 3, differ by 1.
Example 2:
Input:
root = [1,0,48,null,null,12,49]
Output:
1
Explanation:
The closest values in inorder order differ by 1.