java.lang.Object
g0701_0800.s0783_minimum_distance_between_bst_nodes.Solution

public class Solution extends Object
783 - Minimum Distance Between BST Nodes.<p>Easy</p> <p>Given the <code>root</code> of a Binary Search Tree (BST), return <em>the minimum difference between the values of any two different nodes in the tree</em>.</p> <p><strong>Example 1:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2021/02/05/bst1.jpg" alt="" /></p> <p><strong>Input:</strong> root = [4,2,6,1,3]</p> <p><strong>Output:</strong> 1</p> <p><strong>Example 2:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2021/02/05/bst2.jpg" alt="" /></p> <p><strong>Input:</strong> root = [1,0,48,null,null,12,49]</p> <p><strong>Output:</strong> 1</p> <p><strong>Constraints:</strong></p> <ul> <li>The number of nodes in the tree is in the range <code>[2, 100]</code>.</li> <li><code>0 <= Node.val <= 10<sup>5</sup></code></li> </ul> <p><strong>Note:</strong> This question is the same as 530: <a href="https://leetcode.com/problems/minimum-absolute-difference-in-bst/" target="_top">https://leetcode.com/problems/minimum-absolute-difference-in-bst/</a></p>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • minDiffInBST

      public int minDiffInBST(TreeNode root)