Skip to content
Veltoryx Technologies
ProProblem 101● EasyLeetCode #783 ↗3 min readUpdated 30 October 2026

Minimum Distance Between BST Nodes

Find the minimum difference between any two nodes in a BST using an inorder traversal.

01The problem

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

text
       4
      /      2   6
    /    1   3

Inorder: [1, 2, 3, 4, 6]
Differences: 2-1=1, 3-2=1, 4-3=1, 6-4=2
Minimum difference: 1

Constraints

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

Loading the rest of the lesson…