Question bank › Linked List
Dsa Linked List Easy

Parity Segment Reversal

Given a singly linked list, identify contiguous segments of nodes that have the same parity (all even or all odd). Reverse each of these segments in place. Input: A single line of space-separated integers. Output: The modified list values space-separated. Example: Input: 1 3 2 4 6 5 7 Output: 3 1 6 4 2 7 5 (Segments were [1,3], [2,4,6], [5,7]. Reversed: [3,1], [6,4,2], [7,5])

Key concepts

linked_listsublist_manipulationparity

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 InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.