![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 84
zjuwangg
越努力,越幸运
展开
-
卡塔兰数求解BST数目
首先,是在leetcode上遇到的一道求n个自然数可以组成的BST数目。很自然的两种想法:1. 模拟数的生成,时间复杂度会很高,编程困难2.找出树生成数目的生成规律,直接按公式求解然后,关于 卡塔兰数是什么,可以参见维基百科 http://zh.wikipedia.org/wiki/%E5%8D%A1%E5%A1%94%E5%85%B0%E6%95%B0原创 2014-09-24 14:00:30 · 711 阅读 · 0 评论 -
Maximum Product Subarray [leetcode]
/* Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the larges原创 2014-10-02 14:33:13 · 489 阅读 · 0 评论 -
Reverse word in a string [leetcode]
/*Reverse Words in a String Total Accepted: 35825 Total Submissions: 256704 My SubmissionsGiven an input string, reverse the string word by word.For example,Given s = "the sky is blue",r原创 2014-10-02 17:55:47 · 484 阅读 · 0 评论 -
[leetcode] Evaluate the value of reverse polish expression
/*Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "原创 2014-10-02 23:10:43 · 510 阅读 · 0 评论