@@ -0,0 +1,784 @@
+package leetcode.oj.binaryBalanceTree;%0A%0A//http://oj.leetcode.com/problems/balanced-binary-tree/%0A%0Apublic class Solution %7B%0A%09public boolean isBalanced(TreeNode root) %7B%0A%09%09if (root == null) %7B%0A%09%09%09return true;%0A%09%09%7D else %7B%0A%09%09%09int left = getHeight(root.left);%0A%09%09%09int right = getHeight(root.right);%0A%09%09%09boolean res = Math.abs(left - right) %3C= 1;%0A%09%09%09return res && isBalanced(root.left) && isBalanced(root.right);%0A%09%09%7D%0A%0A%09%7D%0A%0A%09public int getHeight(TreeNode root) %7B%0A%09%09if (root == null) %7B%0A%09%09%09return 0;%0A%09%09%7D else %7B%0A%09%09%09int leftHeight = getHeight(root.left);%0A%09%09%09int rightHeight = getHeight(root.right);%0A%0A%09%09%09if (leftHeight %3C= rightHeight)%0A%09%09%09%09return 1 + rightHeight;%0A%09%09%09else%0A%09%09%09%09return 1 + leftHeight;%0A%09%09%7D%0A%09%7D%0A%7D%0A%0Aclass TreeNode %7B%0A%09int val;%0A%09TreeNode left;%0A%09TreeNode right;%0A%0A%09TreeNode(int x) %7B%0A%09%09val = x;%0A%09%7D%0A%7D%0A

add code