Minimum Absolute Difference in BST

Easy · Binary Search Trees · about 10 minutes

Asked at Google, Amazon, Meta, Microsoft.

The binary search tree has two or more nodes. Over every pair of distinct nodes, compute how far apart their values are, and return the smallest such gap.

Related guides