Skip to content

Latest commit

 

History

History
17 lines (10 loc) · 369 Bytes

File metadata and controls

17 lines (10 loc) · 369 Bytes

SwapNodes

Difficulty Tags Solution Link
Medium [Linked Lists] To Do

Problem Description

Given the head node of a singly linked list, swap each pair of nodes and return the head. If there is a last odd node leave it in place.

Sample

Input Output
1 -> 2 -> 3 -> 4 -> 5 2 -> 1 -> 4 -> 3 -> 5