思路:
※一、中序遍历,找第k个元素
class Solution {public:vector<int>res;void inorder(TreeNode *root){if(root==NULL){return;}inorder(root->left);res.push_back(root->val);inorder(root->right);}int kth(int k){return res[k-1];}int kthSmallest(TreeNode* root, int k) {inorder(root);return kth(k);}};