Combinatorics solution


#1

Comment class Solution:
# @param A : integer
# @return an integer
def numTrees(self, A):
return int(self.comb(2*A,A)/(A+1))

def comb(self,n,r):
    return self.fact(n)/self.fact(r)/self.fact(n-r)

def fact(self,n):
    if n==1 or n==0:
        return 1
    else:
        return n*self.fact(n-1)

body goes here.