Question bank › Linked List
Dsa Linked List Easy

Reverse a Sublist

You are given a singly linked list and two integer indices, `start` and `end`. Your task is to reverse the elements of the linked list from index `start` to index `end`, inclusive. The list is indexed from 0. After the reversal, print the modified list in order. Input Format: - The first line will contain an integer N (the number of nodes in the linked list). - The second line will contain N space-separated integers representing the values of the linked list. - The third line will contain two integers `start` and `end`, separated by a space. Output Format: - Print the modified linked list as space-separated integers. Example: Input: 5 1 2 3 4 5 1 3 Output: 1 4 3 2 5

Key concepts

linked_listslicingreversal

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.