摘要: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 解决这个问题需要很巧妙的思路,一般我们会想到观察链表中是否出现过重复出现的节点。 阅读全文
posted @ 2016-04-18 19:57 Black_Knight 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2- 阅读全文
posted @ 2016-04-18 17:09 Black_Knight 阅读(209) 评论(0) 推荐(0) 编辑
摘要: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文
posted @ 2016-04-18 16:23 Black_Knight 阅读(150) 评论(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-04-18 10:35 Black_Knight 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given 1->2 阅读全文
posted @ 2016-04-18 10:33 Black_Knight 阅读(177) 评论(0) 推荐(0) 编辑