class Solution {
public:
TreeNode* searchBST(TreeNode* root, int val) {
if(!root) return root;
if(root->val == val) return root;
else if(root->val > val) return searchBST(root->left,val);
else return searchBST(root->right,val);
}
};
leetcode每日一题第七十二天
最新推荐文章于 2024-11-01 15:19:21 发布