摘要: class Solution { public: bool check(vector<int> &nums,int target,int l,int r)//[l,r]区间查找target { while(l<r) { int mid=(l+r+1)>>1; if(target>=nums[mid] 阅读全文
posted @ 2023-03-28 20:48 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0)
摘要: class Solution { public: void mirror(TreeNode* root) { if(root==NULL) return; mirror(root->left); mirror(root->right); TreeNode* tmp=root->left; root- 阅读全文
posted @ 2023-03-28 19:25 穿过雾的阴霾 阅读(6) 评论(0) 推荐(0)
摘要: class Solution { public: bool dfs(TreeNode* l,TreeNode* r) { if(l==NULL&&r==NULL) return true; else if(l&&r) return l->val==r->val&&dfs(l->left,r->rig 阅读全文
posted @ 2023-03-28 19:25 穿过雾的阴霾 阅读(11) 评论(0) 推荐(0)