C++ solution using in order traversal
class Solution {\n    public:\n        void inorder(TreeNode* root, vector<int> &res){\n            if(!root)\n                return;\n            inorder(root
    class Solution {\n    public:\n        void inorder(TreeNode* root, vector<int> &res){\n            if(!root)\n                return;\n            inorder(root->left, res);\n            res.push_back(root->val);\n            inorder(root->right,res);\n            \n        }\n        int kthSmallest(TreeNode* root, int k) {\n            if(!root)\n                return -1;\n            vector<int> arr;\n            inorder(root, arr);\n            return arr[k-1];\n    \n        }\n    };
[]