HELP(time limited exceed)

  • -1
    void reorderList(ListNode *head) {
        // IMPORTANT: Please reset any member data you declared, as
        // the same Solution instance will be reused for each test case.
        ListNode* node = head;
        ListNode* front;
        ListNode* back;
        while(node != NULL)
            front = node->next;
            if(front == NULL)
            back = front->next;
            if(back == NULL)
            while(back->next!= NULL)
                front = front->next;
                back = back->next;
            back->next = node->next;
            node->next = back;
            front->next= NULL;
            node= node->next->next;

  • 0

    Please tell your algorithm in some words and add some comments in your code, it will make others help you easily.

  • 0

    You need to show that you have done minimal research before asking a question. Please read the FAQ for guidelines on how to ask a question.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.