What do i have to return?

private BalancedPair isBalanced(Node node) {
// write your code here
int leftheight;
int rightheight;
leftheight=height(node.left);
rightheight=height(node.right);
if(Math.abs(leftheight-rightheight)<=1&& isBalanced(node.left)==true&&isBalanced(node.right)==true){
return true;
}
return false;

	}
    public int height(Node node){
        if(node== null){
            return 0;

        }
        return 1+Math.max(height(node.left),height(node.right));
    }

Hi @Hardik-Bhardwaj-392610454600906

  • Get the height of left and right subtrees.
  • Return true if difference between heights is not more than 1 and left and right subtrees are balanced, otherwise return false.