Can anyone help why I always get run time error for this question? I just wiki the algorithm Floyd's cycle-finding algorithm. I think everything should be OK. But it can't pass the last test which is a very large amount of numbers. This is my code:

class Solution {

public:

ListNode *detectCycle(ListNode *head) {

if(!head)

return NULL;

```
ListNode *curr1 = head;
ListNode *curr2 = head;
ListNode *curr3 = head;
while(1){
if((!curr1-> next)||(!curr2->next->next))
break;
curr1 = curr1 -> next;
curr2 = curr2 -> next -> next;
if(curr1 == curr2){
while(1){
curr3 = curr3 -> next;
curr1 = curr1 -> next;
if(curr3 == curr1)
return curr3;
else
continue;
}
}
}
return NULL;
}
```

};

I would really appreciate you if you can help me with that...maybe a meal ;)