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

Reverse Linked List in K Groups

Difficulty: Medium

Acceptance: 60.00%

Points: 30.00

You are given the head of a singly linked list and an integer k. Your task is to reverse the nodes of the linked list in groups of size k and return the head of the modified list. If the remaining nodes are fewer than k, leave them unchanged.

Topics

Companies

Articles

Examples:

N/A

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