48: Balanced binary tree

Given a binary tree, write a method to check if the tree balanced

Note: a height-balanced binary tree is a binary tree in which the depth of the two subtrees of each node does not differ by more than one

 

Example 1

Input:        1
             / \
            2   3   <-- difference = 2
           /   /
          4   5  
             /  
            6 

Output: false

Example 2

Input:     1   
          / \  
         5   3 

Output: true