✅ | Easy | 3 Solutions
___\n# 1\n\n\nclass Solution {\n    int ans=Integer.MAX_VALUE;\n    int count=1;\n    public int kthSmallest(TreeNode root, int k) {\n        if(root==null) ret
_____________________\n# 1\n\n```\nclass Solution {\n    int ans=Integer.MAX_VALUE;\n    int count=1;\n    public int kthSmallest(TreeNode root, int k) {\n        if(root==null) return 0;\n        kthSmallest(root.left,k);\n        if(count==k){\n            ans=root.val;\n        }\n        count++;\n        kthSmallest(root.right,k);\n        return ans; \n    }\n}\n```\n_____________________\n# 2\n\n```\nclass Solution {\n    PriorityQueue<Integer> pq=new PriorityQueue<>();\n    public int kthSmallest(TreeNode root, int k) {\n        if(root==null) return -1;        \n        helper(root);\n        int count=1;\n        while(count<k){\n            pq.poll();\n            count++;\n        }   \n        return pq.poll(); \n    }\n    public void helper(TreeNode root){\n        if(root==null) return;      \n        pq.add(root.val);\n        helper(root.left);\n        helper(root.right);\n    }\n}\n```\n\n\n_____________________\n# 3\n```\nclass Solution {\n    int ans=0;\n    ArrayList<Integer> arr= new ArrayList<>();\n    public int kthSmallest(TreeNode root, int k) {\n        if(root==null) return 0;\n        kthSmallestHelper(root,k);\n        return ans;\n    }\n    public void kthSmallestHelper(TreeNode root, int k) {\n        if(root==null)  return;\n        kthSmallestHelper(root.left,k);\n        arr.add(root.val);\n        if(arr.size()==k){\n            ans=root.val;\n            return;\n        }\n        kthSmallestHelper(root.right, k);\n    }\n}\n```\n______________________________________\n\n**Up Vote if Helps**![image.png](https://assets.leetcode.com/users/images/23d8443e-ac59-49d5-99f0-9273a2147be2_1687635435.0337658.png)\n\n______________________________________
['Binary Search Tree', 'Recursion', 'Heap (Priority Queue)', 'Java']