Description:
Given an integer n, generate all structurally unique BST’s (binary search trees) that store values 1 … n.
Example:
1 | Input: 3 |
Similar Question: 96.unique-binary-search-trees
Binary Search Tree(BST):
- Key(L)<Key(Current)<Key(R)
- Both subtrees of each node are also BSTs
Appropriate Answer (Divide-and-conquer):
1 |
|
ʕ •ᴥ•ʔ:由 linsheng 提供的解法。