/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } }; */ class Solution { public: ListNode* EntryNodeOfLoop(ListNode* pHead) { ListNode *pre = pHead, *temp; while(pre){ if(pre->next==pre) return pre->next; temp = pre; pre = pre->next; temp->next = temp; } return NULL; } };
点赞

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务