aboutsummaryrefslogtreecommitdiff
path: root/validate_bst.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'validate_bst.cpp')
-rw-r--r--validate_bst.cpp24
1 files changed, 0 insertions, 24 deletions
diff --git a/validate_bst.cpp b/validate_bst.cpp
deleted file mode 100644
index 0785d47..0000000
--- a/validate_bst.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "leetcode.h"
-
-class Solution {
-public:
- bool isValidBST(TreeNode *root) {
- if (!root)
- return true;
- inOrder(root);
- for (int i = 1; i < tree.size(); i++)
- if (tree[i] <= tree[i - 1])
- return false;
- return true;
- }
-
-private:
- vector<int> tree;
- void inOrder(TreeNode *root) {
- if (!root)
- return;
- inOrder(root->left);
- tree.push_back(root->val);
- inOrder(root->right);
- }
-};