class IsTreeBalanced {

  public boolean check(BinaryNode root) {
    if (root == null) {
      return true;
    } else {
      int heightDifference = getRootHeight(root.getLeft()) - getRootHeight(root.getRight());
      return Math.abs(heightDifference) <= 1;
    }
  }

}