Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees ofevery node never differ by more than 1.
要求判斷一棵二叉樹是否是平衡二叉樹,即每個節點的左右子樹高度差不超過1。
思路:採用遞歸的方式,分別判斷左右子樹是否是平衡樹,再計算左右兩棵子樹的高度差是否超過1。
代碼AC: