diff options
Diffstat (limited to 'kth_smallest_BST.cpp')
-rw-r--r-- | kth_smallest_BST.cpp | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/kth_smallest_BST.cpp b/kth_smallest_BST.cpp deleted file mode 100644 index 73243d4..0000000 --- a/kth_smallest_BST.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - set<int> s; - int kthSmallest(TreeNode *root, int k) { - traverse(root); - for (auto ans : s) { - k--; - if (!k) - return ans; - } - return 0; - } - -private: - void traverse(TreeNode *root) { - if (!root) - return; - s.insert(root->val); - traverse(root->left); - traverse(root->right); - } -}; - -int main() {} |