We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f88bcf8 commit 1c913a4Copy full SHA for 1c913a4
0206_reverse_linked_list/reverse_list.c
@@ -31,8 +31,10 @@ struct ListNode *reverseList(struct ListNode *head)
31
struct ListNode *prev = NULL;
32
struct ListNode *p = head;
33
while (p != NULL) {
34
+ /* prev <- p <- q */
35
struct ListNode *q = p->next;
36
p->next = prev;
37
+ /* step */
38
prev = p;
39
p = q;
40
}
0206_reverse_linked_list/reverse_list.cc
@@ -18,8 +18,10 @@ class Solution {
18
ListNode *prev = nullptr;
19
ListNode *p = head;
20
while (p != nullptr) {
21
+ // prev <- p <- q
22
ListNode *q = p->next;
23
24
+ // step
25
26
27
0 commit comments