{ "type": "code_options", "author": "https://github.com/begeekmyfriend/leetcode", "source": "solution.md", "exercise_id": "4655300e1df74e79ae306dd06c7c4cbe", "keywords": "树,深度优先搜索,二叉搜索树,二叉树", "title": "验证二叉搜索树", "desc": [ { "content": "\n
给你一个二叉树的根节点 root
,判断其是否是一个有效的二叉搜索树。
有效 二叉搜索树定义如下:
", "language": "markdown" }, { "content": "\n", "language": "markdown" }, { "content": "\n
示例 1:
\n\n输入:root = [2,1,3]\n输出:true\n", "language": "markdown" }, { "content": "\n
示例 2:
\n\n输入:root = [5,1,4,null,null,3,6]\n输出:false\n解释:根节点的值是 5 ,但是右子节点的值是 4 。\n", "language": "markdown" }, { "content": "\n
", "language": "markdown" }, { "content": "\n
提示:
", "language": "markdown" }, { "content": "\n[1, 104]
内-231 <= Node.val <= 231 - 1