human
4.4 Check balanced.
Implement a function to check if a binary tree is balanced. For the purpose of this quesiton, a balanced tree is defined to be a tree such that the heights of the two subtress of any node never differ by more than one.
assistant
#Here is the Python program you requested.
class Node:
    def __init(self)__:
        self.value = value
        self.left = None
        self.right = None

def checkBalanced(root):
    if root is None:
        return 0
    
    left = checkBalanced(root.left)
    right = checkBalanced(root.right) 
    
    if abs(left - right) > 1:
        return -1
    
    return max(left, right) + 1