263. Minimum Absolute Difference in BST

EasyBST

Given the root of a Binary Search Tree (BST), return the minimum absolute difference between the values of any two different nodes in the tree.

Examples

Input: [4,2,6,1,3]

Output: 1

Explanation: In-order values 1,2,3,4,6 have a minimum adjacent gap of 1.

Constraints

  • The number of nodes in the tree is in the range [2, 10^4].
  • 0 <= Node.val <= 10^5
Loading...

Run checks all cases above. Submit evaluates all test cases.