![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
YtiniFni
这个作者很懒,什么都没留下…
展开
-
二叉树节点的最近邻公共祖先节点
二叉树节点的最近邻公共祖先节点介绍求一个二叉树中两个节点的最近邻公共祖先节点(LCA According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes v and w as the lowest node in T that has bot原创 2015-07-21 11:30:42 · 837 阅读 · 0 评论 -
求从1到n构成的BST的个数
求从1到n构成的BST的个数题目LeetCode 96. Unique Binary Search Trees 求从11到nn构成所有BST的个数,比如,当n=3n=3时,共有55个BST 题解考虑对于以数kk为根节点的BST,比kk小的数在左子树上,比kk大的数在右子树上,那么以数kk为根节点的BST的个数为[0,k−1][0, k-1]组成的BST的个数mm与[k+1,n][k+1, n]组原创 2016-04-07 21:20:39 · 775 阅读 · 0 评论