Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
Problem Submissions Solution

Reverse Linked List in Pairs

Difficulty: Medium

Acceptance: 63.00%

Points: 30.00

You are given the head of a singly linked list. Your task is to reverse every two consecutive nodes in the linked list and return the head of the modified list. If the linked list contains an odd number of nodes, the last node remains unchanged.

Topics

Companies

Articles

Examples:

N/A

Constraints:
  • 1 = Number of nodes = 105
  • -10? = Node.data = 10?
Companies:
Amazon Microsoft Apple Samsung Visa
Topics:
Linked List
Locked Content
Access Restricted: Please Login to access the code editor and test cases.