ListNode* reverseList(ListNode* head) {
        if(head== nullptr)
            return head;
        ListNode *rear= nullptr,*front=nullptr;
        while(head!= nullptr){
            front=head->next;
            head->next=rear;
            rear=head;
            head=front;
        }
        return rear;
    }

相关文章:

  • 2021-09-02
  • 2021-11-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-08
  • 2021-07-10
  • 2021-12-29
  • 2021-08-25
相关资源
相似解决方案