![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
递归
Mr.阿Q
每天【打卡】任务日常搬砖
展开
-
Leetcode 21 合并两个有序链表 学习感悟
思路:迭代一个个往里面加# include<iostream># include<vector># include<string># include<algorithm># include<math.h># include<climits># include<stack>using namespace std;struct ListNode { int val; ListNode* next;原创 2020-10-06 21:59:35 · 927 阅读 · 0 评论 -
Leetcode 24 两两交换链表中的节点 学习感悟
思路:递归思想2->1->4->3->5 链表,head=21互换,变12的返回值,其中2的next等于调用下一层435的返回值,43互换变34返回值节点3给2的next,4的next调用递归5的返回值# include<iostream># include<vector># include<string># include<algorithm># include<math.h># include<原创 2020-10-08 13:19:11 · 121 阅读 · 0 评论 -
Leetcode 25 k个一组翻转链表 递归
思路:日常递归每k个完成操作,递归一次# include<iostream># include<vector># include<string># include<algorithm># include<math.h># include<climits># include<stack># include<queue>using namespace std;struct ListNod原创 2020-10-08 13:42:34 · 102 阅读 · 0 评论