【开源中国 APP 全新上线】“动弹” 回归、集成大模型对话、畅读技术报告”
int is_looplist (ListNode * head)
{
ListNode * p1, * p2;
p1 = p2 = head;
if (head == NULL || head -> next == NULL)
{
return 0 ;
}
while (p2 -> next != NULL && p2 -> next -> next != NULL)
{
p1 = p1 -> next;
p2 = p2 -> next -> next;
if (p1 == p2)
{
return 1 ;
}
}
return 0 ;
}
原文链接: http://blog.csdn.net/tody_guo/article/details/5412847