标签:interview
Node findCircle(Node head) { Node p1 = head; Node p2 = head; while (p2 != null) { if (p1 == p2) { break; } p1 = p1.next; p2 = p2.next; p2 = p2 == null ? null : p2.next; } if (p2 == null) return null; p1 = head; while (p1 != p2) { p1 = p1.next; p2 = p2.next; } return p1; }
标签:interview
原文地址:http://7371901.blog.51cto.com/7361901/1581737