make listB a cycle, and then find the begin of the cycle.but i have a MLE problem, i do not know why

```
class Solution{
public:
ListNode* getIntersectionNode(ListNode* headA, ListNode *headB){
if(headA == nullptr || headB == nullptr) return NULL;
ListNode* tail = headB;
while(tail->next != nullptr){
tail = tail->next;
}
if(headA->next == nullptr)
if (headA == tail) return headA;
else return NULL;
tail->next = headB;
ListNode* slow = headA;
ListNode* fast = headA;
do{
if(slow == nullptr || fast->next == nullptr) return NULL;
else{slow = slow->next;
fast = fast->next->next;}
}while(fast != slow && fast != NULL && slow != NULL);
if(fast == nullptr || slow == nullptr) return NULL;
slow = headA;
while(fast != slow){
fast = fast->next;
slow = slow->next;
}
tail->next = NULL;
return slow;
}
};
```