aboutsummaryrefslogtreecommitdiff
path: root/unique_bst.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unique_bst.cpp')
-rw-r--r--unique_bst.cpp23
1 files changed, 0 insertions, 23 deletions
diff --git a/unique_bst.cpp b/unique_bst.cpp
deleted file mode 100644
index 7aefacd..0000000
--- a/unique_bst.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "leetcode.h"
-
-class Solution {
-public:
- int numTrees(int n) {
- if (n == 1)
- return 1;
- vector<int> dp(n + 1);
- dp[0] = dp[1] = 1;
- for (int i = 2; i <= n; i++) {
- for (int j = 0; j < i; j++) {
- int k = i - 1 - j;
- dp[i] += (dp[j] * dp[k]);
- }
- }
- return dp[n];
- }
-};
-
-int main() {
- Solution obj;
- cout << obj.numTrees(3);
-}