struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};
*/
class Solution {
public:
ListNode* EntryNodeOfLoop(ListNode* pHead) {
int a[10005]={0};
while(pHead){
if(!a[pHead->val])
a[pHead->val]=1;
else return pHead;
pHead=pHead->next;
}
return NULL;
}
};