48: Balanced binary tree
Given a binary tree, write a method to check if the tree balanced
Note: a
height-balancedbinary tree is a binary tree in which thedepthof the two subtrees ofeach nodedoes not differ by more thanone
Example 1
Input: 1
/ \
2 3 <-- difference = 2
/ /
4 5
/
6
Output: false
Example 2
Input: 1
/ \
5 3
Output: true