上一页 1 2 3 4 5 6 7 ··· 12 下一页
摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Note:Do not modify the linked list.Follow up:Can you sol... 阅读全文
posted @ 2015-11-18 10:38 AprilCheny 阅读(674) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Subscribeto see which companies asked this... 阅读全文
posted @ 2015-11-17 20:01 AprilCheny 阅读(888) 评论(0) 推荐(0) 编辑
摘要: Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL.Subsc... 阅读全文
posted @ 2015-11-17 18:25 AprilCheny 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No... 阅读全文
posted @ 2015-11-17 11:00 AprilCheny 阅读(720) 评论(0) 推荐(0) 编辑
摘要: Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi... 阅读全文
posted @ 2015-11-16 19:50 AprilCheny 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor... 阅读全文
posted @ 2015-11-16 18:58 AprilCheny 阅读(304) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-... 阅读全文
posted @ 2015-11-16 16:19 AprilCheny 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list inO(nlogn) time using constant space complexity.Subscribeto see which companies asked this question解法:这题和Insertion Sort List链表插入排序一... 阅读全文
posted @ 2015-11-16 15:25 AprilCheny 阅读(564) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list using insertion sort.Subscribeto see which companies asked this question解法:设置3个指针:应插入位置的前一个节点first、当前处理节点third和其前一个节点second,设置辅助节点h... 阅读全文
posted @ 2015-11-16 13:04 AprilCheny 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --... 阅读全文
posted @ 2015-11-16 10:41 AprilCheny 阅读(158) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 12 下一页