328奇偶链表 Posted on 2020-04-19 Words count in article: 187 | Reading time ≈ 1 328.奇偶链表下面是题目下面是题目给出的模板1234567891011121314/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ... Read more »
19删除链表的倒数第N个节点 Posted on 2020-04-19 Words count in article: 749 | Reading time ≈ 3 19.删除链表的倒数第N个节点下面是题目 下面是题目给出的代码1234567891011121314/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *nex ... Read more »
2两数相加 Posted on 2020-04-19 Words count in article: 1.2k | Reading time ≈ 5 两数相加I 和II下面是题目I 和题目II 这题比较折磨我,因为我一开始的思路,是用一个整型直接存储两个链表的数字,然后加起来,后来发现有类似于10000000000000这样的数据。让我不管取多大的,都会被越界。后来找了题解,给出几种解法 1-1利用位数补齐的方法。然后分别计算位数123456 ... Read more »
0208面试题环路检测 Posted on 2020-04-19 Words count in article: 555 | Reading time ≈ 2 02.08面试题 环路检测下面是题目 这题和141.环形链表相近,但是需要考虑更多有俩个指针 fast ,slow分别的从起点a 开始走,slow走一步,fast走里俩步。如果过程中 快fast走到null,说明不存在环。否则fast和slow一定会相遇,相遇后,slow待在原地不动,将 fast放 ... Read more »
1019链表中的下一个更大元素 Posted on 2020-04-19 Words count in article: 472 | Reading time ≈ 2 1019.链表中的下一个更大元素下面是题目下面是题目给出的模板1234567891011121314/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *nex ... Read more »
143重排链表 Posted on 2020-04-19 Words count in article: 759 | Reading time ≈ 3 143.重排列表下面是题目 下面是题目给出的模板12345678910111213/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ... Read more »
1171从链表中删除总和值为0的连续节点 Posted on 2020-04-19 Words count in article: 867 | Reading time ≈ 3 1171. 从链表中删去总和值为零的连续节点下面是题目,需要注意的是,题目说的是总和为0的连续结点下面是题目给出的模板1234567891011121314/** * Definition for singly-linked list. * struct ListNode { * ... Read more »
82删除排序链表中的重复元素2 Posted on 2020-04-19 Words count in article: 680 | Reading time ≈ 3 82. 删除排序链表中的重复元素 II下面是题目 下面是题目给出的模板1234567891011121314/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode ... Read more »
92反转链表 Posted on 2020-04-19 Words count in article: 631 | Reading time ≈ 2 92. 反转链表 II下面是题目 下面是题目给出的代码模板1234567891011121314/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; ... Read more »
61旋转链表 Posted on 2020-04-19 Words count in article: 372 | Reading time ≈ 1 61.旋转链表下面是题目 下面是题目给出的模板1234567891011121314/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ... Read more »