Untitled
unknown
plain_text
a year ago
330 B
9
Indexable
class Solution { public: ListNode* reverseList(ListNode* head) { ListNode *temp = nullptr, *prev = nullptr; while(head) { temp = head->next; head->next = prev; prev = head; head = temp; } return prev; } };
Editor is loading...
Leave a Comment