高度差是否超过1 超过1就不是平衡二叉树

public class Solution {
    boolean res = true;
    public boolean IsBalanced_Solution(TreeNode root) {
        if(root == null){
            return true;
        }
        treeHeight(root);
        return res;
        
    }
    
    public int treeHeight(TreeNode root){
        if(root == null){
            return 0;
        }
       int  leftH =  treeHeight(root.left);
       int   rightH = treeHeight(root.right);
        boolean isbalance = Math.abs(leftH-rightH)<=1;
        if(Math.abs(leftH-rightH)>1)  res = false;
        int height = Math.max(leftH+1,rightH+1);
        return height;
   
    }
}