My python solution


  • 0
    T
    class Solution:
        # @param {integer} n
        # @return {integer}
        def numTrees(self, n):
            t=1;
            for i in range(2,n+1):
                t=2*(2*i-1)*t/(i+1)
            return t

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.