Easy to understand JAVA solution
public class Solution {\n        public int kthSmallest(TreeNode root, int k) {\n            int leftNum = countNodes(root.left);\n            \n            if 
    public class Solution {\n        public int kthSmallest(TreeNode root, int k) {\n            int leftNum = countNodes(root.left);\n            \n            if (leftNum + 1 == k)\n                return root.val;\n            else if (leftNum  + 1 > k) {\n                return kthSmallest(root.left, k);\n            }\n            else\n                return kthSmallest(root.right, k - leftNum - 1);\n        }\n        \n        private int countNodes(TreeNode root) {\n            if (root == null)\n                return 0;\n            \n            return 1 + countNodes(root.left) + countNodes(root.right);\n        }\n    }\n\n\n\nThe idea is to determine where the target falls (left side, the root, or the right side) at each level.
[]