题目地址
LeetCode#96 Unique Binary Search Trees
题目描述
Given n, how many structurally unique BST’s (binary search trees) that store values 1 … n?
Example:
1 | Input: 3 |
解题思路
卡特兰数 + DP 求解。
解题代码
1 | class Solution { |
你想开发游戏还是改变世界?
LeetCode#96 Unique Binary Search Trees
Given n, how many structurally unique BST’s (binary search trees) that store values 1 … n?
Example:
1 | Input: 3 |
卡特兰数 + DP 求解。
1 | class Solution { |