java.lang.Object
g0501_0600.s0530_minimum_absolute_difference_in_bst.Solution

public class Solution extends Object
530 - Minimum Absolute Difference in BST.<p>Easy</p> <p>Given the <code>root</code> of a Binary Search Tree (BST), return <em>the minimum absolute 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, 10<sup>4</sup>]</code>.</li> <li><code>0 <= Node.val <= 10<sup>5</sup></code></li> </ul> <p><strong>Note:</strong> This question is the same as 783: <a href="https://leetcode.com/problems/minimum-distance-between-bst-nodes/" target="_top">https://leetcode.com/problems/minimum-distance-between-bst-nodes/</a></p>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • getMinimumDifference

      public int getMinimumDifference(TreeNode root)