For this Question: Given a binary tree, determine if it is height-balanced. Tree is rooted at 1.

Height-balanced binary tree : is defined as a binary tree in which the depth of the two sub-trees of every node never differ by more than 1.The first line of the input contains an integer N, the number of nodes in the Binary Tree.
The following N-1 lines contain two integers, u and v, denoting an edge.

Constraints
1 <= N <= 100000
1 <= u, v <= N
u and v are distinctOutput "YES" if tree is balanced, else output "NO".Sample Input
3
1 2
1 3

Sample Output
YES

Sample Input
3
1 2
2 3

Sample Output
NO, I have written this Solution Code: import java.io.*;
import java.util.*;



class Node{
	Node left, right;
	int data;
	Node(int data){this.data = data;}
}
class Main {
	public static int BalancedBinaryTree(Node root){
		if(root == null) return 0;
		if(root.left == null && root.right == null) return 1;

		int l = BalancedBinaryTree(root.left);
		int r = BalancedBinaryTree(root.right);

		if(Math.abs(l - r) > 1 || l == -1 || r == -1) return -1;

		return Math.max(l, r) + 1;
	}
	public static void main (String[] args) {
        Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		Node[] Tree = new Node[n];
		for(int i = 0; i < n; i++){
			Tree[i] = new Node(i+1);
		}
		for(int i = 0; i < n-1; i++){
			int u = input.nextInt();
			int v = input.nextInt();
			if(Tree[u-1].left == null) Tree[u-1].left = Tree[v-1];
			else Tree[u-1].right = Tree[v-1];
		}
		System.out.println(BalancedBinaryTree(Tree[0]) != -1 ? "YES" : "NO");
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?