public static int checkHeight(TreeNode<Integer> root) {
		if (root == null)
			return 0;

		int left = checkHeight(root.left);
		int right = checkHeight(root.right);
		if (left == -1 || right == -1) {
			return -1;
		}
		if (Math.abs(left - right) > 1)
			return -1;

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