[CareerCup] 2.6 Linked List Cycle 单链表中的环

 

2.6 Given a circular linked list, implement an algorithm which returns the node at the beginning of the loop.
DEFINITION
Circular linked list: A (corrupt) linked list in which a node's next pointer points to an earlier node, so as to make a loop in the linked list.
EXAMPLE
Input: A - > B - > C - > D - > E - > C [the same C as earlier]
Output: C

 

LeetCode中的原题,请参见我之前的博客 Linked List Cycle 单链表中的环 和 Linked List Cycle II 单链表中的环之二

 

posted @ 2015-07-21 20:40  Grandyang  阅读(672)  评论(0编辑  收藏  举报
Fork me on GitHub