![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
从小爱吃鱼
这个作者很懒,什么都没留下…
展开
-
148.Sort List
题目描述:Sort a linked list in O(n log n) time using constant space complexity.利用归并排序:归并排序的思路 1)首先找到链表的中点(使用两个指针,一个一次跑一个,一个一次跑两个) 2)递归的对中点左边排序 3)递归的对中点右边排序 4)原创 2016-05-11 15:38:35 · 250 阅读 · 0 评论 -
143.Reorder List
题目描述:Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder原创 2016-05-11 16:30:15 · 345 阅读 · 0 评论 -
203. Remove Linked List Elements
题目描述:Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5---------------原创 2016-04-24 11:07:26 · 238 阅读 · 0 评论 -
234. Palindrome Linked List
题目描述:Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?-------------------------------------------------------------------原创 2016-04-24 10:37:58 · 248 阅读 · 0 评论