(root)
return True
:type root: TreeNode
    :rtype: bool
:type root: TreeNode
    :rtype: bool
: type root : TreeNode : rtype : bool
def is_bst(root):
    """
    :type root: TreeNode
    :rtype: bool
    """

    stack = []
    pre = None
    
    while root or stack:
        while root:
            stack.append(root)
            root = root.left
        root = stack.pop()
        if pre and root.val <= pre.val:
            return False
        pre = root
        root = root.right

    return True
def is_bst ( root ) : stack = [ ] pre = None while root or stack : while root : stack . append ( root ) root = root . left root = stack . pop ( ) if pre and root . val <= pre . val : return False pre = root root = root . right return True