Question bank › Linked List
Dsa Linked List Hard

K-Grouped Reverser

You are tasked with reversing elements of a linked list in groups of size k. If the number of nodes is not a multiple of k, the remaining nodes at the end should remain in their original order. Input Format: - The first line contains two integers n and k (the number of nodes, group size). - The next n lines contain one integer each, representing the nodes from head to tail. Output Format: - A single line with the modified linked list in order, separated by spaces. Example: Input: 5 3 1 2 3 4 5 Output: 3 2 1 4 5

Key concepts

linked_listgroup_reversal

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.