We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a9348a1 commit 8f61f0dCopy full SHA for 8f61f0d
C++/odd-even-linked-list.cpp
@@ -13,13 +13,13 @@ class Solution {
13
public:
14
ListNode* oddEvenList(ListNode* head) {
15
if (head) {
16
- for (ListNode *odd_tail = head, *cur = head->next;
17
- cur && cur->next;
18
- cur = cur->next) {
+ for (auto odd_tail = head, curr = head->next;
+ curr && curr->next;
+ curr = curr->next) {
19
ListNode *even_head = odd_tail->next;
20
- odd_tail->next = cur->next;
+ odd_tail->next = curr->next;
21
odd_tail = odd_tail->next;
22
- cur->next = odd_tail->next;
+ curr->next = odd_tail->next;
23
odd_tail->next = even_head;
24
}
25
0 commit comments