🌻C++ Easy intuitive || Recursion || Extra Space
Please Upvote if you Like :)\n\nclass Solution {\npublic:\n    set<int> s;\n    void traverse(TreeNode* root){\n        if(!root) return;\n        s.insert(root
**Please Upvote if you Like :)**\n```\nclass Solution {\npublic:\n    set<int> s;\n    void traverse(TreeNode* root){\n        if(!root) return;\n        s.insert(root->val);\n        traverse(root->left);\n        traverse(root->right);\n    }\n    int kthSmallest(TreeNode* root, int k) {  \n        traverse(root);\n        for(auto ans:s){\n            k--;\n            if(!k) return ans;\n        }\n        return 0;\n    }\n};\n```
['Recursion', 'C']