@@ -0,0 +1,791 @@
+package hackerrank.datastructure.tree.bst;%0A%0A/**%0A * Validate if it's valid BST%0A */%0Apublic class BstValidation %7B%0A%0A    public boolean checkBST(Node root) %7B%0A        return doCheckBST(root, 0, Integer.MAX_VALUE);%0A    %7D%0A%0A    private boolean doCheckBST(Node root, int low, int high) %7B%0A        if (root == null) return true;%0A        return (low %3C root.data && root.data %3C high) &&%0A                doCheckBST(root.left, low, root.data) &&%0A                doCheckBST(root.right, root.data, high);%0A    %7D%0A%0A    // Wrong!%0A    boolean checkBST2(Node root) %7B%0A        if (root == null) return true;%0A        return (root.left == null %7C%7C root.left.data %3C root.data) &&%0A                (root.right == null %7C%7C root.data %3C root.right.data) &&%0A                checkBST(root.left) && checkBST(root.right);%0A    %7D%0A%0A%7D%0A

validate bst