C++ solution--counting numbers of left tree
class Solution {\n\npublic:\n\n    int kthSmallest(TreeNode root, int k) {\n        if (!root) return 0;\n        if (k==0) return root->val;\n        \n       
class Solution {\n\npublic:\n\n    int kthSmallest(TreeNode* root, int k) {\n        if (!root) return 0;\n        if (k==0) return root->val;\n        \n        int n=count_size(root->left);\n        if (k==n+1) return root->val;\n        \n        if (n>=k){\n            return kthSmallest(root->left, k);\n        }\n        if (n<k){\n            return kthSmallest(root->right, k-n-1);\n        }\n        \n    }\n\n    int count_size(TreeNode* root){\n        if (!root) return 0;\n        return 1+count_size(root->left)+count_size(root->right);\n        \n    }\n  \n};
['Binary Tree', 'C++']