中序遍历是否为递增数组
class Solution(object):
def isValidBST(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
#中序遍历为递增数组
list = []
def inorder(root):
if root == None:
return
inorder(root.left)
list.append(root.val)
inorder(root.right)
inorder(root)
for i in range(len(list)-1):
if list[i]>=list[i+1]:
return False
return True