Preview:
        if(!head || head->next  == NULL)
            return head;
        Node* fast = head->next->next,*slow = head;
        while(fast->next && fast->next->next){
            fast = fast->next->next;
            slow = slow->next;
        }
        if(fast != NULL)
            slow = slow->next;
        Node* head2 = reverse(slow->next);
        slow->next =  NULL;
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter