摘要: Question:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Analysis:只想到了,首先判断是否有环,若有环,则总链首开始,一次判断是否是环的开始,这... 阅读全文
posted @ 2015-09-12 21:21 江湖小妞 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Question:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Analysis:思路一:快慢指针法。前面用到过快慢指针寻找链表的... 阅读全文
posted @ 2015-09-12 20:42 江湖小妞 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Question:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.Analysis:合并k个排好序的链表,返回最终一个总的排序列表。分析并描述他的复杂度。l... 阅读全文
posted @ 2015-09-12 20:16 江湖小妞 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Question:Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkth... 阅读全文
posted @ 2015-09-12 13:27 江湖小妞 阅读(299) 评论(0) 推荐(0) 编辑
摘要: Question: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.Y... 阅读全文
posted @ 2015-09-12 11:17 江湖小妞 阅读(148) 评论(0) 推荐(0) 编辑