上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页
摘要: 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)
摘要: class Solution { public: bool check(TreeNode* r1, TreeNode* r2) { if(r2==NULL) return true;//如果r2为空,无论r1,都匹配成功 if(r1&&r2) { if(r1->val!=r2->val) retur 阅读全文
posted @ 2023-03-27 22:03 穿过雾的阴霾 阅读(14) 评论(0) 推荐(0)
摘要: class Solution { public: ListNode* merge(ListNode* l1, ListNode* l2) { ListNode* dummy=new ListNode(-1),*tail=dummy; while(l1&&l2) { if(l1->val>l2->va 阅读全文
posted @ 2023-03-27 21:23 穿过雾的阴霾 阅读(11) 评论(0) 推荐(0)
摘要: 1. 页表大小随虚拟地址空间增加,随页面大小减小 页面太大了,不就变成了分区吗,就有外部碎片了 2. 百分比增加,valid的变多 3. 我也没看出有什么不妥 可能前两个组合对于虚拟地址空间来说太大了,最后一个组合又太小了?? 4. 想让程序不正常运行,可以让虚拟地址空间比内存大,或者虚拟地址空间大 阅读全文
posted @ 2023-03-27 16:04 穿过雾的阴霾 阅读(18) 评论(0) 推荐(0)
摘要: class Solution { public: int fac[10]; void init() { fac[0]=1; fac[1]=1; for(int i=2;i<10;i++) fac[i]=fac[i-1]*i; return; } string str; bool visited[10 阅读全文
posted @ 2023-03-25 16:24 穿过雾的阴霾 阅读(15) 评论(0) 推荐(0)
摘要: #递归 class Solution { public: ListNode* reverseList(ListNode* head) { if(head==NULL||head->next==NULL) return head; //先反转head后面的链表,最后将head接在新链表最后即可 aut 阅读全文
posted @ 2023-03-25 15:30 穿过雾的阴霾 阅读(11) 评论(0) 推荐(0)
摘要: class Solution { public: //f[i]表示跳到i所需的最小步数 int jump(vector<int>& nums) { vector<int> f(10010,0x3f3f3f3f); int n=nums.size(); f[0]=0; for(int i=0;i<n; 阅读全文
posted @ 2023-03-24 14:26 穿过雾的阴霾 阅读(20) 评论(0) 推荐(0)
摘要: class Solution { public: //f[i]表示下标i是否能跳到 static const int N=3e4+10; bool canJump(vector<int>& nums) { int n=nums.size(); for(int i=0,j=0;i<n;i++)//j记 阅读全文
posted @ 2023-03-24 14:15 穿过雾的阴霾 阅读(15) 评论(0) 推荐(0)
摘要: #方法1,遍历一次,使用额外空间 哈希直接存储指针出现的次数,如果重复出现,直接返回即可 class Solution { public: unordered_map<ListNode*,int> hashmap;//记录指针及其出现的次数+1 ListNode *entryNodeOfLoop(L 阅读全文
posted @ 2023-03-24 11:50 穿过雾的阴霾 阅读(13) 评论(0) 推荐(0)
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 20 下一页