summaryrefslogtreecommitdiff
path: root/cpp/96.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-02-23 21:07:19 +0800
committercrupest <crupest@outlook.com>2021-02-23 21:07:19 +0800
commitd8f3b40085619cb680c8f227c65a1f5acc393223 (patch)
tree6a38e3a6c79276fc396259ef962d17236dbed569 /cpp/96.cpp
parentb0162802ad9723c678e495f29ca2f0fc0af2eff1 (diff)
downloadsolutions-d8f3b40085619cb680c8f227c65a1f5acc393223.tar.gz
solutions-d8f3b40085619cb680c8f227c65a1f5acc393223.tar.bz2
solutions-d8f3b40085619cb680c8f227c65a1f5acc393223.zip
Move leetcode solutions to subdir.
Diffstat (limited to 'cpp/96.cpp')
-rw-r--r--cpp/96.cpp14
1 files changed, 0 insertions, 14 deletions
diff --git a/cpp/96.cpp b/cpp/96.cpp
deleted file mode 100644
index a67a59a..0000000
--- a/cpp/96.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-class Solution {
-public:
- // catalan number:
- // f(n) = f(0) * f(n-1) + f(1) * f(n-2) + ... + f(n-1)*f(0)
- // f(n) = 2(2n-1) * f(n-1) / (n+1)
- // f(n) = C(2n, n) / (n+1)
- int numTrees(int n) {
- long long result = 1;
- for (int i = 2; i <= n; i++) {
- result = 2 * (2 * i - 1) * result / (i + 1);
- }
- return result;
- }
-};