C++ Recursive soln 10 lines code
```\nclass Solution {\npublic:\n    int val;\n    int ans;\n    void fun(TreeNode root)\n    {\n        if(root==NULL)\n            return ;\n        fun(root->
```\nclass Solution {\npublic:\n    int val;\n    int ans;\n    void fun(TreeNode *root)\n    {\n        if(root==NULL)\n            return ;\n        fun(root->left);\n        val--;\n        if(val==0)\n            ans=root->val;\n        fun(root->right);\n    }\n    int kthSmallest(TreeNode* root, int k) {\n        val=k;\n        fun(root);\n        return ans;\n    }\n};
['Recursion', 'C', 'C++']