I wanted to try the solution of marked method, but I got stuck in this test case:

Input:

[1]

tail connects to node index 0

Output:

no cycle

Expected:

tail connects to node index 0

I couldn't figure out what happened.

Could anyone help me to clear my blindspot ?

thank you

## My solution:

```
ListNode *detectCycle(ListNode *head) {
vector<ListNode*> check;
if (!head || !head->next) return NULL;
while (!head) {
if (find(check.begin(), check.end(), head) != check.end()) {
return head;
}
check.push_back(head);
// Move to next
if (!head->next) {
head = head->next;// point to next one
}
}
return NULL;
}
```