Open youngyangyang04 opened 3 months ago
打卡😁
class Solution {
public TreeNode searchBST(TreeNode node, int val) {
if (node == null || node.val == val) return node;
if (node.val > val) {
return searchBST(node.left, val);
} else {
return searchBST(node.right, val);
}
}
}
https://www.programmercarl.com/0700.%E4%BA%8C%E5%8F%89%E6%90%9C%E7%B4%A2%E6%A0%91%E4%B8%AD%E7%9A%84%E6%90%9C%E7%B4%A2.html