class Solution:
    def isBalanced(self,root):
    
        #add code here
        self.final = True
        def check(root):
            if not root:
                return 0
            
            left = check(root.left)
            right = check(root.right)
            
            if abs(left - right) > 1:
                self.final = False
            
            return max(left , right)+1
        
        check(root)
        return self.final

a56e9bd00d4e459ff809ca6ce6f28406c5392032
<mask token>

class Solution:
    <mask token>

class Solution:

    def isBalanced(self, root):
        self.final = True

        def check(root):
            if not root:
                return 0
            left = check(root.left)
            right = check(root.right)
            if abs(left - right) > 1:
                self.final = False
            return max(left, right) + 1
        check(root)
        return self.final

class Solution:
    def isBalanced(self,root):
    
        #add code here
        self.final = True
        def check(root):
            if not root:
                return 0
            
            left = check(root.left)
            right = check(root.right)
            
            if abs(left - right) > 1:
                self.final = False
            
            return max(left , right)+1
        
        check(root)
        return self.final
