✅ JAVA || Easy to Understand || [ 100% faster 🔥🔥 ]
Complexity\n- Time complexity: O(n) where n = No. of Nodes\n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution {\n    public TreeNode searchBST(TreeNode roo
# Complexity\n- Time complexity: O(n) where n = No. of Nodes\n\n- Space complexity: O(1)\n\n# Code\n```\nclass Solution {\n    public TreeNode searchBST(TreeNode root, int val) {\n        while(root!=null){\n            if(root.val>val){\n                root=root.left;\n            }\n            else if(root.val<val){\n                root=root.right;\n            }\n            else{\n                return root;\n            }\n        }\n        return null;\n    }\n}\n```
['Tree', 'Binary Search Tree', 'Binary Tree', 'Java']