0206. Reverse Linked List
Easy | Linked List + Two Pointer | 16 ms (98.94%), 15.4 MB (80.06%)
Source: LeetCode - Reverse Linked List GitHub: Solution / Performance
Given the head
of a singly linked list, reverse the list, and return the reversed list.
We need two pointers, one for recording the previous node, and the other one for iterating the linked list.
We reverse the linked list by modifying the current node's next pointer to make it point to the previous node.
Last updated