/
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode next;
* ListNode(int x) : val(x), next(NULL) {}
* };
/
class Solution {
public:
unordered_map[HTML_REMOVED] mp;
int num = 0;
ListNode entryNodeOfLoop(ListNode head) {
auto p =head;
while(head && head->next){
if(mp.count(head) != 0){
for(int i = 0;i < mp[head]-1; i){
p = p->next;
}
return p;
}
mp[head] = num;
head = head->next;
}
return NULL;
}
};