def closestValue(self, root, target):
        """
        Divide the problem into 2 parts:
        1. find the value just smaller than target
        2. find the value just larger than target
        :type root: TreeNode
        :type target: float
        :rtype: int
        """
        lo = [-sys.float_info.max]
        self.find(root, target, lo, True)
        hi = [sys.float_info.max]
        self.find(root, target, hi, False)
        if hi[0] - target < target - lo[0]:
            return int(hi[0])
        else:
            return int(lo[0])
dataset/ETHPy150Open algorhythms/LeetCode/270 Closest Binary Search Tree Value.py/Solution.closestValue/original