Reverse a singly linked list.

 

思路:没啥好说的。秒...

ListNode* reverseList(ListNode* head) {
        ListNode * rList = NULL, * tmp = NULL;
        while(head != NULL)
        {
            tmp = rList;
            rList = head;
            head = head->next;
            rList->next = tmp;
        }
        return rList;
    }

 

相关文章:

  • 2021-05-28
  • 2022-12-23
  • 2021-06-13
  • 2021-12-06
  • 2022-02-18
  • 2021-08-30
  • 2021-10-14
  • 2021-08-20
猜你喜欢
  • 2021-09-07
  • 2022-02-13
  • 2021-07-21
  • 2021-05-27
  • 2021-07-26
  • 2021-08-02
  • 2021-06-09
相关资源
相似解决方案