Only Premium Users can view the Question
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.