```
public boolean isValidBST(TreeNode root) {
if(root==null)
return true;
return check(root, Long.MAX_VALUE, Long.MIN_VALUE); //How can I get rid of this????
}
public boolean check(TreeNode node, long max, long min )
{
long limit = node.val;
if(node.left!=null)
{
if(node.left.val>=limit || node.left.val<=min)
return false;
}
if(node.right!=null)
{
if(node.right.val<=limit || node.right.val>=max)
return false;
}
if(node.right!=null && node.left!=null)
return check(node.left, node.val, min) && check(node.right, max, node.val);
else if(node.right!=null && node.left==null)
return check(node.right, max, node.val);
else if(node.right==null && node.left!=null)
return check(node.left, node.val, min);
else
return true;
}
```

Can anyone help me with this? I don't want to use MAX_VALUE or MIN_VALUE of long. It was accepted bc the test case doesn't have Long.MAX_VALUE. it does have Integer.MAX_VALUE so I changed it to Long. Any thoughts would be greatly appreciated!