MCPcopy Create free account
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / factorial

Method factorial

AwesomeAlgorithms/CatalanNumber.py:17–21  ·  view source on GitHub ↗
(self, n)

Source from the content-addressed store, hash-verified

15 return self.factorial(n << 1) // (self.factorial(n) * self.factorial(n + 1))
16 # 定义一个函数求取n的阶乘
17 def factorial(self, n):
18 result = 1
19 for i in range(1, n + 1):
20 result *= i
21 return result
22
23s = Solution()
24print(s.numTrees(0))

Callers 1

numTreesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected