/自己总结的翻转链表的模式写法,能有效避免指针越界/ ListNode prev = nullptr; ListNode cur = head; ListNode* next; while(cur){ next = cur->next; cur->next = prev; prev = cur; cur = next; }
return prev;