Unique Binary Search Trees 问题(leetcode )

来源:互联网 发布:2016网络情歌对唱大全 编辑:程序博客网 时间:2024/06/01 14:44

理解二叉查找树


96. Unique Binary Search Trees

题目地址

https://leetcode.com/problems/unique-binary-search-trees/

题目描述

Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?

For example,
Given n = 3, there are a total of 5 unique BST’s.

   1         3     3      2      1    \       /     /      / \      \     3     2     1      1   3      2    /     /       \                 \   2     1         2                 3

95. Unique Binary Search Trees II

题目地址

https://leetcode.com/problems/unique-binary-search-trees-ii/

0 0
原创粉丝点击