摘要: 方法一 活用set 方法二 快慢指针 阅读全文
posted @ 2018-12-20 21:38 INnoVation-V2 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 方法一 利用set容器处理 方法二 快慢指针 快指针每次走两步,慢指针每次走一步,设两指针相遇点为meet,那么从meet和head同时出发,同样速度前进,相遇节点即为环的起点 阅读全文
posted @ 2018-12-20 21:21 INnoVation-V2 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 解法一(两链表共同后缀长度相同) 解法二 set不能保存重复元素 阅读全文
posted @ 2018-12-20 17:02 INnoVation-V2 阅读(117) 评论(0) 推荐(0) 编辑
摘要: ```c++ ListNode* reverseBetween(ListNode* head, int m, int n) { if(m==n) return head; ListNode *front=head,*begin=nullptr; if(m!=1){ for (int x = m - 1;... 阅读全文
posted @ 2018-12-20 17:01 INnoVation-V2 阅读(108) 评论(0) 推荐(0) 编辑
摘要: ```c++ ListNode* reverseList(ListNode* head) { if(head== nullptr) return head; ListNode *rear= nullptr,*front=nullptr; while(head!= nullptr){ front=... 阅读全文
posted @ 2018-12-20 16:59 INnoVation-V2 阅读(105) 评论(0) 推荐(0) 编辑