@@ -0,0 +1,1411 @@
+package binarytree;%0A%0Aimport datastructures.tree.BinarySearchTree;%0Aimport datastructures.tree.TreeNode;%0A%0Apublic class CheckBSTHasDeadEnd %7B%0A  private BinarySearchTree%3CInteger%3E tree = null;%0A  private TreeNode%3CInteger%3E root = null;%0A%0A  public CheckBSTHasDeadEnd() %7B%0A    tree = new BinarySearchTree%3CInteger%3E();%0A  %7D%0A%0A  public void constructTree(String%5B%5D input) %7B%0A    for (String line : input) %7B%0A      String%5B%5D values = line.split(%22 %22);%0A      String action = values%5B0%5D;%0A%0A      switch (action) %7B%0A      case %22insertRoot%22:%0A        tree = new BinarySearchTree%3CInteger%3E();%0A        root = tree.insertRoot(Integer.parseInt(values%5B1%5D));%0A        break;%0A      case %22insert%22:%0A        tree.insert(root, Integer.parseInt(values%5B1%5D));%0A        break;%0A      %7D%0A    %7D%0A  %7D%0A%0A  public boolean hasDeadEnd() %7B%0A    return hasDeadEnd(root, new Range(0, Integer.MAX_VALUE));%0A  %7D%0A%0A  private boolean hasDeadEnd(TreeNode%3CInteger%3E root, Range range) %7B%0A    if(root == null) %7B%0A      return false;%0A    %7D else if (root.left == null && root.right == null) %7B%0A      return Math.abs(root.data - range.min) %3C= 1 && Math.abs(range.max - root.data) %3C= 1;%0A    %7D else %7B%0A      return hasDeadEnd(root.left, new Range(range.min, root.data)) %7C%7C hasDeadEnd(root.right, new Range(root.data, range.max));%0A    %7D%0A  %7D%0A%0A  private class Range %7B%0A    private int min;%0A    private int max;%0A%0A    Range(int min, int max) %7B%0A      this.min = min;%0A      this.max = max;%0A    %7D%0A  %7D%0A%7D%0A

Add solution for CheckBST has dead end