Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.
Example:
Input: 1 \ 3 / 2 Output: 1 Explanation: The minimum absolute difference is 1, which is the difference between 2 and 1 (or between 2 and 3).
# -*- coding:utf-8 -*-
__author__ = 'yangxin_ryan'
"""
Solutions:
由于题目给定的是BST,则可以知道每个节点的左子树 < root < 右子树;
那么我们可以遍历BST获取最小的差值;
"""
class MinimumAbsoluteDifferenceInBST(object):
def getMinimumDifference(self, root: TreeNode) -> int:
left