Question: Cradle Point , Recent Online Assessment (13th September 2023) | Binary Search Tree Solution
int kthSmallest(TreeNode* root, int& k) {
if (root) {
int x = kthSmallest(root->left, k);
return !k ? x : !--k ? root->val : kthSmallest(root->right, k);
}
return 0;
}
Login before adding your answer.