{ "type": "code_options", "author": "https://github.com/begeekmyfriend/leetcode", "source": "solution.md", "exercise_id": "93f4a20c10584a4aa9a52d08e6f1df50", "keywords": "树,二叉搜索树,动态规划,回溯,二叉树", "title": "不同的二叉搜索树 II", "desc": [ { "content": "\n
给你一个整数 n
,请你生成并返回所有由 n
个节点组成且节点值从 1
到 n
互不相同的不同\n二叉搜索树 。可以按 任意顺序 返回答案。\n
", "language": "markdown" }, { "content": "\n
示例 1:
\n\n输入:n = 3\n输出:[[1,null,2,null,3],[1,null,3,2],[2,1,3],[3,1,null,null,2],[3,2,null,1]]\n", "language": "markdown" }, { "content": "\n
示例 2:
", "language": "markdown" }, { "content": "\n输入:n = 1\n输出:[[1]]\n", "language": "markdown" }, { "content": "\n
", "language": "markdown" }, { "content": "\n
提示:
", "language": "markdown" }, { "content": "\n1 <= n <= 8