Technical Interview: Part 11 (Q&A): Linked List - Reverse a Linked List in groups of a given size

Опубликовано: 10 Март 2026
на канале: Technical Interview
974
22

Given a linked list, write a program to reverse the nodes in the linked list in a group of size = k

Inputs: 1-2-3-4-5-6-7-8-NULL and k = 3
Output: 3-2-1-6-5-4-8-7-NULL.

Inputs: 1-2-3-4-5-6-7-8-NULL and k = 5
Output: 5-4-3-2-1-8-7-6-NULL.

Code: https://bit.ly/37d3Iio

[IMPORTANT]
Complete List of interview questions that you need to prepare: https://bit.ly/36AY8Y4

**This video comes under "MEDIUM" section of interview questions.
To understand what and how a linked list works, please refer the videos below:

Linked List Series:
Part 1: Introduction to linked list:    • Technical Interview: Part 1: Introduction ...  
Part 2: Understanding the Implementation ( in JAVA):    • Technical Interview: Part 2: Introduction ...  
Part 3: Inserting a node at the beginning of the list:    • Technical Interview: Part 3: Linked List -...  
Part 4: Inserting a node at the end of the list:    • Technical Interview: Part 4: Linked List -...  
Part 5: Inserting a node after a given node :    • Technical Interview: Part 5: Linked List -...  
Part 6: Deleting an element from the list:    • Technical Interview: Part 6: Linked List -...  

Q&A
Part 7: Find the middle of a given linked list in LinkedList (Java) :    • Technical Interview: Part 7 (Q&A): Linked ...  
Part 8: Find the Nth node from the end of Linked List (Java):    • Technical Interview: Part 8 (Q&A): Linked ...  
Part 9: How to reverse a Linked List (Java):    • Technical Interview: Part 9 (Q&A): Linked ...  
Part 10: How to detect a loop in Linked List (Java):    • Technical Interview: Part 10 (Q&A): Linked...  
Part 11: How to detect & remove loop in Linked List(Java):    • Technical Interview: Part 11 (Q&A): Linked...  

#technicalinterview #codinginterview #crackingthetechnicalinterview

Social Connect:
LinkedIn:   / anindya-sankar-dasgupta-39a315ba  
Facebook:   / technicalinterview03  
Instagram:   / anindya_bunny  

Additional Tags:
reverse a linked list in groups of given size java,
reverse a linked list in groups of given size leetcode,
reverse a linked list in a group of given size,
reverse a doubly linked list in groups of given size,
reverse a linked list in groups of given size in java
reverse a linked list in groups of given size,
reverse a linked list in java,
reverse a linked list using recursion,
reverse a linked list hackerrank solution java,
reverse a linked list in groups,
reverse a linked list algorithm,
reverse a linked list animation,
reverse a linked list gfg,
reverse a linked list geeksforgeeks,
reverse a linked list by recursion,
reverse a linked list explanation,
reverse a linked list from position m to n,
how to reverse a linked list,
how to reverse a linked list in java,
reverse a linked list java recursive,
reverse a linked list java hackerrank,
reverse a linked list java geeksforgeeks,
reverse a doubly linked list java,
how to reverse a linked list using recursion,
how to reverse a linked list recursively java,
reverse a linked list using recursion java,
reverse a linked list using iteration,
reverse a linked list with recursion,
reverse a linked list without using extra space,
reverse linked list 2