标签:date public new turn false empty return treenode sea
public class Solution {
public boolean isValidBST(TreeNode root) {
Stack<TreeNode> stack=new Stack<TreeNode>();
TreeNode cur=null;
while(root!=null||!stack.isEmpty())
{
while(root!=null)
{
stack.push(root);
root=root.left;
}
root=stack.pop();
if(cur!=null&&cur.val>=root.val)
return false;
cur=root;
root=root.right;
}
return true;
}
}
98. Validate Binary Search Tree
标签:date public new turn false empty return treenode sea
原文地址:http://www.cnblogs.com/asuran/p/7609352.html