Swap Nodes in Pairs

Description

Flashcards on Swap Nodes in Pairs, created by Suhas S on 17/02/2018.
Suhas S
Flashcards by Suhas S, updated more than 1 year ago
Suhas S
Created by Suhas S almost 8 years ago
2
0

Resource summary

Question Answer
Swap Nodes in Pairs public ListNode swapPairs(ListNode head) { if(head == null || head.next == null) return head; ListNode n = head.next; head.next = swapPairs(head.next.next); n.next = head; return n; }
Show full summary Hide full summary

Similar

Linked List
Subash M
Delete Node in a BST
Suhas S
Delete a node with a key
Suhas S
Remove Nth Node From End of List
Suhas S
Merge Two Sorted Lists
Suhas S
Odd Even Linked List
Suhas S
Rotate List
Suhas S
Add Two Numbers
Suhas S
Copy List with Random Pointer
Suhas S