> For the complete documentation index, see [llms.txt](https://emmaguo100.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://emmaguo100.gitbook.io/leetcode/06-14-2022-95.-unique-binary-search-trees-ii.md).

# 06/14/2022 95. Unique Binary Search Trees II

Method: recursion. the recurrence relation is we could construct BST by getting left\_trees = generate*trees(start, i - 1) and getting right\_trees =* generate*trees(i+1, right). Then construct the root* TreeNode current\_tree = new TreeNode(i); and connect left and right tree with the root.&#x20;

Time: O(n \*Gn)

Space O(n \*Gn)
