Test case 2 is not passing please suggest changes

Node* detectCycle(Node* head)
{

Node* fast=head, * slow=head;


while(fast->next!=NULL)
{

    fast=fast->next->next;
    slow=slow->next;

    if(fast==slow)
    {
        return fast;
    }



}
return NULL;

}

bool floydCycleRemoval(Node *head)

{
/* Code here */

if(head==NULL|| head->next==NULL)
{
    return false;
}

Node* intersection=detectCycle(head);

if(
    intersection!=NULL
)
{
Node * slow=head;

while(slow!=intersection)
{
    slow=slow->next;
    intersection=intersection->next;

}

while(slow->next!=intersection)
{
    slow=slow->next;
}
slow->next=NULL;

return true;

}
else{
    return false;
}

}

bool floydCycleRemoval(Node *head)
{
    /* Code here */
    if(head == NULL || head->next == NULL){
            return false;
        }
        if(head->next == head){
            head->next = NULL;
            return true;
        }
        
        Node* slow = head;
        Node* fast = head;
        bool foundcycle = false;
        while(fast!=NULL && fast->next!=NULL){
            slow = slow->next;
            fast = fast->next->next;
            if(slow == fast){
                foundcycle = true;
                break;
            }
        }

        if(foundcycle==false){
            return false;
        }
        
        if(foundcycle == true){
            if(fast == head){
                Node* temp = head;
                while(temp->next != head){
                    temp = temp->next;
                }
                temp->next = NULL;
            }
            else{
                Node* temp = head;
                while(slow->next != temp->next){
                    temp = temp->next;
                    slow = slow->next;
                }
                slow->next = NULL;
            }
        }
        return true;
}

whats wrong in my code please tell me that

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.