摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Recursiv 阅读全文
posted @ 2016-09-08 23:37 咖啡中不塌缩的方糖 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 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? if use space O(1), we need to use 阅读全文
posted @ 2016-09-08 22:38 咖啡中不塌缩的方糖 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 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 -- 阅读全文
posted @ 2016-09-08 12:25 咖啡中不塌缩的方糖 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, 阅读全文
posted @ 2016-09-08 12:00 咖啡中不塌缩的方糖 阅读(97) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 典型的2 pointer 问题,一个走的快,一个走到慢,如果是cycle就一定会 阅读全文
posted @ 2016-09-08 11:15 咖啡中不塌缩的方糖 阅读(99) 评论(0) 推荐(0) 编辑