Skip to content

Commit 8f61f0d

Browse files
committed
Update odd-even-linked-list.cpp
1 parent a9348a1 commit 8f61f0d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

C++/odd-even-linked-list.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ class Solution {
1313
public:
1414
ListNode* oddEvenList(ListNode* head) {
1515
if (head) {
16-
for (ListNode *odd_tail = head, *cur = head->next;
17-
cur && cur->next;
18-
cur = cur->next) {
16+
for (auto odd_tail = head, curr = head->next;
17+
curr && curr->next;
18+
curr = curr->next) {
1919
ListNode *even_head = odd_tail->next;
20-
odd_tail->next = cur->next;
20+
odd_tail->next = curr->next;
2121
odd_tail = odd_tail->next;
22-
cur->next = odd_tail->next;
22+
curr->next = odd_tail->next;
2323
odd_tail->next = even_head;
2424
}
2525
}

0 commit comments

Comments
 (0)