Archive
LeetCode - Swap Nodes in Pairs
요즘 재귀에 꽂혀있음. class Solution { public: ListNode* swapPairs(ListNode* head) { if(!head) { return head; } ListNode* first= head; ListNode* second = head->next; ListNode* dummy = new ListNode(-1); dummy->next = first; ListNode* prev = dummy; while(second){ ListNode* temp = second->next; first->next = second->next; second->next = first; prev->next = second; prev = first; if(temp){ first = temp; secon..