You won't get anything more simpler than this


#1

void solve(TreeNodeA,vector&v)
{
if(A==NULL)
{
return;
}
solve(A->left,v);
v.push_back(A->val);
solve(A->right,v);
}
int Solution::kthsmallest(TreeNode
A, int B)
{
vectorv;
solve(A,v);
return v[B-1];
}