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; }
CC150 2.5
精选 转载furuijie8679 博主文章分类:Interview
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章