C++ easiest || inorder traversal || 3 line solution || not any extra function
/we have to find kth smallest value so using inorder traversal and also decreasing k when k=0 it means we are at right node which value will be kth smallest ele
/*we have to find kth smallest value so using inorder traversal and also decreasing k when k=0 it means we are at right node which value will be kth smallest element ,that\'s i used an int variable ans to store the val ...int k argument is reference argument so after  recursive call back the value of k will not  not same as it was when the function was called */\n```\nclass Solution {\n   \npublic:\n    int ans;\n    int kthSmallest(TreeNode* root, int &k) {\n        if(root){\n            kthSmallest(root->left,k);\n            k--;\n            if(k==0) ans=root->val;\n            kthSmallest(root->right,k);\n        }\n        return ans;\n    }\n};\n```
['C++']